@Override
 public IJObject access(IVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool)
     throws HyracksDataException {
   byte[] b = pointable.getByteArray();
   int s = pointable.getStartOffset();
   int l = pointable.getLength();
   ARectangle v =
       ARectangleSerializerDeserializer.INSTANCE.deserialize(
           new DataInputStream(new ByteArrayInputStream(b, s, l)));
   JRectangle jObject = (JRectangle) objectPool.allocate(BuiltinType.ARECTANGLE);
   jObject.setValue(v.getP1(), v.getP2());
   return jObject;
 }
 @Override
 public IJObject access(IVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool)
     throws HyracksDataException {
   byte[] b = pointable.getByteArray();
   int s = pointable.getStartOffset();
   int l = pointable.getLength();
   APolygon v =
       APolygonSerializerDeserializer.INSTANCE.deserialize(
           new DataInputStream(new ByteArrayInputStream(b, s, l)));
   JPolygon jObject = (JPolygon) objectPool.allocate(BuiltinType.APOLYGON);
   jObject.setValue(v.getPoints());
   return jObject;
 }
 @Override
 public IJObject access(IVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool)
     throws HyracksDataException {
   byte[] b = pointable.getByteArray();
   int s = pointable.getStartOffset();
   int l = pointable.getLength();
   ADuration duration =
       ADurationSerializerDeserializer.INSTANCE.deserialize(
           new DataInputStream(new ByteArrayInputStream(b, s, l)));
   IJObject jObject = objectPool.allocate(BuiltinType.ADURATION);
   ((JDuration) jObject).setValue(duration.getMonths(), duration.getMilliseconds());
   return jObject;
 }
 @Override
 public IJObject access(IVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool)
     throws HyracksDataException {
   byte[] b = pointable.getByteArray();
   int s = pointable.getStartOffset();
   int l = pointable.getLength();
   ACircle v =
       ACircleSerializerDeserializer.INSTANCE.deserialize(
           new DataInputStream(new ByteArrayInputStream(b, s, l)));
   JPoint jpoint = (JPoint) objectPool.allocate(BuiltinType.APOINT);
   jpoint.setValue(v.getP().getX(), v.getP().getY());
   IJObject jObject = objectPool.allocate(BuiltinType.ACIRCLE);
   ((JCircle) jObject).setValue(jpoint, v.getRadius());
   return jObject;
 }
    @Override
    public IJObject access(IVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool)
        throws HyracksDataException {
      IJObject jObject = objectPool.allocate(BuiltinType.ASTRING);

      try {
        byte byteArray[] = pointable.getByteArray();
        int len = pointable.getLength() - 3;
        int off = pointable.getStartOffset() + 3;
        baaos.reset();
        if (off >= 0 && off <= byteArray.length && len >= 0 && off + len - byteArray.length <= 0) {
          baaos.write(byteArray, off, len);
          ((JString) jObject).setValue(JObjectUtil.getNormalizedString(baaos.toString("UTF-8")));
        } else {
          ((JString) jObject).setValue("");
        }
      } catch (IOException e) {
        e.printStackTrace();
      }
      return jObject;
    }
    @Override
    public JRecord access(
        ARecordVisitablePointable pointable,
        IObjectPool<IJObject, IAType> objectPool,
        ARecordType recordType,
        JObjectPointableVisitor pointableVisitor)
        throws HyracksDataException {
      try {
        jRecord.reset();
      } catch (AlgebricksException e) {
        throw new HyracksDataException(e);
      }
      ARecordVisitablePointable recordPointable = (ARecordVisitablePointable) pointable;
      List<IVisitablePointable> fieldPointables = recordPointable.getFieldValues();
      List<IVisitablePointable> fieldTypeTags = recordPointable.getFieldTypeTags();
      List<IVisitablePointable> fieldNames = recordPointable.getFieldNames();
      int index = 0;
      boolean closedPart = true;
      try {
        IJObject fieldObject = null;
        for (IVisitablePointable fieldPointable : fieldPointables) {
          closedPart = index < recordType.getFieldTypes().length;
          IVisitablePointable tt = fieldTypeTags.get(index);
          IAType fieldType = closedPart ? recordType.getFieldTypes()[index] : null;
          ATypeTag typeTag =
              EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
                  tt.getByteArray()[tt.getStartOffset()]);
          IVisitablePointable fieldName = fieldNames.get(index);
          typeInfo.reset(fieldType, typeTag);
          switch (typeTag) {
            case RECORD:
              fieldObject =
                  pointableVisitor.visit((ARecordVisitablePointable) fieldPointable, typeInfo);
              break;
            case ORDEREDLIST:
            case UNORDEREDLIST:
              if (fieldPointable instanceof AFlatValuePointable) {
                // value is null
                fieldObject = null;
              } else {
                fieldObject =
                    pointableVisitor.visit((AListVisitablePointable) fieldPointable, typeInfo);
              }
              break;
            case ANY:
              break;
            default:
              fieldObject = pointableVisitor.visit((AFlatValuePointable) fieldPointable, typeInfo);
          }
          if (closedPart) {
            jObjects[index] = fieldObject;
          } else {
            byte[] b = fieldName.getByteArray();
            int s = fieldName.getStartOffset();
            int l = fieldName.getLength();
            String v =
                AStringSerializerDeserializer.INSTANCE
                    .deserialize(new DataInputStream(new ByteArrayInputStream(b, s + 1, l - 1)))
                    .getStringValue();
            openFields.put(v, fieldObject);
          }
          index++;
          fieldObject = null;
        }

      } catch (Exception e) {
        e.printStackTrace();
        throw new HyracksDataException(e);
      }
      return jRecord;
    }