use of org.apache.asterix.om.pointables.nonvisitor.AListPointable in project asterixdb by apache.
the class RecordFieldsUtil method processListValue.
public void processListValue(IValueReference listArg, IAType fieldType, DataOutput out, int level) throws AsterixException, IOException {
ArrayBackedValueStorage itemValue = getTempBuffer();
IARecordBuilder listRecordBuilder = getRecordBuilder();
AListPointable list = getListPointable();
list.set(listArg);
OrderedListBuilder innerListBuilder = getOrderedListBuilder();
innerListBuilder.reset(listType);
listRecordBuilder.reset(null);
AbstractCollectionType act = (AbstractCollectionType) fieldType;
int itemCount = list.getItemCount();
for (int l = 0; l < itemCount; l++) {
itemValue.reset();
listRecordBuilder.init();
byte tagId = list.getItemTag(act, l);
addFieldType(tagId, listRecordBuilder);
if (tagId == ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
ArrayBackedValueStorage tmpAbvs = getTempBuffer();
list.getItemValue(act, l, tmpAbvs.getDataOutput());
addNestedField(tmpAbvs, act.getItemType(), listRecordBuilder, level + 1);
}
listRecordBuilder.write(itemValue.getDataOutput(), true);
innerListBuilder.addItem(itemValue);
}
innerListBuilder.write(out, true);
}
Aggregations