use of org.apache.asterix.om.base.IAObject in project asterixdb by apache.
the class ARecordSerializerDeserializer method deserialize.
@Override
public ARecord deserialize(DataInput in) throws HyracksDataException {
try {
boolean isExpanded = isExpandedRecord(in);
IAObject[] schemaFields = getValuesForSchemaFields(in);
if (isExpanded) {
int numberOfOpenFields = in.readInt();
String[] fieldNames = new String[numberOfOpenFields];
IAType[] fieldTypes = new IAType[numberOfOpenFields];
IAObject[] openFields = new IAObject[numberOfOpenFields];
for (int i = 0; i < numberOfOpenFields; i++) {
in.readInt();
in.readInt();
}
for (int i = 0; i < numberOfOpenFields; i++) {
fieldNames[i] = AStringSerializerDeserializer.INSTANCE.deserialize(in).getStringValue();
openFields[i] = AObjectSerializerDeserializer.INSTANCE.deserialize(in);
fieldTypes[i] = openFields[i].getType();
}
ARecordType openPartRecType = new ARecordType(null, fieldNames, fieldTypes, true);
if (numberOfSchemaFields > 0) {
ARecordType mergedRecordType = mergeRecordTypes(this.recordType, openPartRecType);
IAObject[] mergedFields = mergeFields(schemaFields, openFields);
return new ARecord(mergedRecordType, mergedFields);
} else {
return new ARecord(openPartRecType, openFields);
}
} else {
return new ARecord(this.recordType, schemaFields);
}
} catch (IOException e) {
throw new HyracksDataException(e);
}
}
use of org.apache.asterix.om.base.IAObject in project asterixdb by apache.
the class AUnorderedListSerializerDeserializer method deserialize.
@Override
public AUnorderedList deserialize(DataInput in) throws HyracksDataException {
// TODO: schemaless unordered list deserializer
try {
ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(in.readByte());
IAType currentItemType = itemType;
@SuppressWarnings("rawtypes") ISerializerDeserializer currentDeserializer = deserializer;
if (itemType.getTypeTag() == ATypeTag.ANY && typeTag != ATypeTag.ANY) {
currentItemType = TypeTagUtil.getBuiltinTypeByTag(typeTag);
currentDeserializer = SerializerDeserializerProvider.INSTANCE.getNonTaggedSerializerDeserializer(currentItemType);
}
// list size
in.readInt();
int numberOfitems;
numberOfitems = in.readInt();
ArrayList<IAObject> items = new ArrayList<IAObject>();
if (numberOfitems > 0) {
if (!NonTaggedFormatUtil.isFixedSizedCollection(currentItemType)) {
for (int i = 0; i < numberOfitems; i++) in.readInt();
}
for (int i = 0; i < numberOfitems; i++) {
items.add((IAObject) currentDeserializer.deserialize(in));
}
}
AUnorderedListType type = new AUnorderedListType(currentItemType, "unorderedlist");
return new AUnorderedList(type, items);
} catch (Exception e) {
throw new HyracksDataException(e);
}
}
Aggregations