Search in sources :

Example 1 with AListPointable

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);
}
Also used : ArrayBackedValueStorage(org.apache.hyracks.data.std.util.ArrayBackedValueStorage) AListPointable(org.apache.asterix.om.pointables.nonvisitor.AListPointable) IARecordBuilder(org.apache.asterix.builders.IARecordBuilder) OrderedListBuilder(org.apache.asterix.builders.OrderedListBuilder) AbstractCollectionType(org.apache.asterix.om.types.AbstractCollectionType)

Aggregations

IARecordBuilder (org.apache.asterix.builders.IARecordBuilder)1 OrderedListBuilder (org.apache.asterix.builders.OrderedListBuilder)1 AListPointable (org.apache.asterix.om.pointables.nonvisitor.AListPointable)1 AbstractCollectionType (org.apache.asterix.om.types.AbstractCollectionType)1 ArrayBackedValueStorage (org.apache.hyracks.data.std.util.ArrayBackedValueStorage)1