Search in sources :

Example 1 with SettableListObjectInspector

use of org.apache.hadoop.hive.serde2.objectinspector.SettableListObjectInspector in project hive by apache.

the class VectorDeserializeRow method convertListRowColumn.

private Object convertListRowColumn(ColumnVector colVector, int batchIndex, Field field) throws IOException {
    final SettableListObjectInspector listOI = (SettableListObjectInspector) field.objectInspector;
    final ListComplexTypeHelper listHelper = (ListComplexTypeHelper) field.getComplexHelper();
    final Field elementField = listHelper.getElementField();
    final List<Object> tempList = new ArrayList<>();
    final ListColumnVector listColumnVector = (ListColumnVector) colVector;
    while (deserializeRead.isNextComplexMultiValue()) {
        tempList.add(convertComplexFieldRowColumn(listColumnVector.child, batchIndex, elementField));
    }
    final int size = tempList.size();
    final Object list = listOI.create(size);
    for (int i = 0; i < size; i++) {
        listOI.set(list, i, tempList.get(i));
    }
    return list;
}
Also used : StructField(org.apache.hadoop.hive.serde2.objectinspector.StructField) SettableListObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.SettableListObjectInspector) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 SettableListObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.SettableListObjectInspector)1 StructField (org.apache.hadoop.hive.serde2.objectinspector.StructField)1