public void reset() throws HyracksDataException { try { jRecord.reset(); } catch (AlgebricksException e) { throw new HyracksDataException(e); } openFields.clear(); }
@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; }