Search in sources :

Example 1 with UnionColumnVector

use of org.apache.hadoop.hive.ql.exec.vector.UnionColumnVector in project hive by apache.

the class BatchToRowReader method nextUnion.

private UnionType nextUnion(ColumnVector vector, int row, UnionTypeInfo schema, Object previous) {
    if (vector.isRepeating) {
        row = 0;
    }
    if (vector.noNulls || !vector.isNull[row]) {
        List<TypeInfo> childrenTypes = schema.getAllUnionObjectTypeInfos();
        UnionType result = createUnionObject(childrenTypes, previous);
        UnionColumnVector union = (UnionColumnVector) vector;
        byte tag = (byte) union.tags[row];
        setUnion(result, tag, nextValue(union.fields[tag], row, childrenTypes.get(tag), getUnionField(result)));
        return result;
    } else {
        return null;
    }
}
Also used : UnionColumnVector(org.apache.hadoop.hive.ql.exec.vector.UnionColumnVector) MapTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.MapTypeInfo) ListTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.ListTypeInfo) StructTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo) PrimitiveTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo) TypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfo) UnionTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.UnionTypeInfo) VarcharTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo) CharTypeInfo(org.apache.hadoop.hive.serde2.typeinfo.CharTypeInfo)

Example 2 with UnionColumnVector

use of org.apache.hadoop.hive.ql.exec.vector.UnionColumnVector in project hive by apache.

the class RecordReaderImpl method copyUnionColumn.

void copyUnionColumn(ColumnVector destination, ColumnVector source, int sourceOffset, int length) {
    UnionColumnVector castedSource = (UnionColumnVector) source;
    UnionColumnVector castedDestination = (UnionColumnVector) destination;
    castedDestination.isRepeating = castedSource.isRepeating;
    castedDestination.noNulls = castedSource.noNulls;
    if (source.isRepeating) {
        castedDestination.isNull[0] = castedSource.isNull[0];
        int tag = castedSource.tags[0];
        castedDestination.tags[0] = tag;
        if (!castedDestination.isNull[0]) {
            copyColumn(castedDestination.fields[tag], castedSource.fields[tag], 0, 1);
        }
    } else {
        if (!castedSource.noNulls) {
            for (int r = 0; r < length; ++r) {
                castedDestination.isNull[r] = castedSource.isNull[sourceOffset + r];
                castedDestination.tags[r] = castedSource.tags[sourceOffset + r];
            }
        } else {
            for (int r = 0; r < length; ++r) {
                castedDestination.tags[r] = castedSource.tags[sourceOffset + r];
            }
        }
        for (int c = 0; c > castedSource.fields.length; ++c) {
            copyColumn(castedDestination.fields[c], castedSource.fields[c], sourceOffset, length);
        }
    }
}
Also used : UnionColumnVector(org.apache.hadoop.hive.ql.exec.vector.UnionColumnVector)

Example 3 with UnionColumnVector

use of org.apache.hadoop.hive.ql.exec.vector.UnionColumnVector in project hive by apache.

the class RecordReaderImpl method nextUnion.

static OrcUnion nextUnion(ColumnVector vector, int row, TypeDescription schema, Object previous) {
    if (vector.isRepeating) {
        row = 0;
    }
    if (vector.noNulls || !vector.isNull[row]) {
        OrcUnion result;
        List<TypeDescription> childrenTypes = schema.getChildren();
        if (previous == null || previous.getClass() != OrcUnion.class) {
            result = new OrcUnion();
        } else {
            result = (OrcUnion) previous;
        }
        UnionColumnVector union = (UnionColumnVector) vector;
        byte tag = (byte) union.tags[row];
        result.set(tag, nextValue(union.fields[tag], row, childrenTypes.get(tag), result.getObject()));
        return result;
    } else {
        return null;
    }
}
Also used : UnionColumnVector(org.apache.hadoop.hive.ql.exec.vector.UnionColumnVector) TypeDescription(org.apache.orc.TypeDescription)

Aggregations

UnionColumnVector (org.apache.hadoop.hive.ql.exec.vector.UnionColumnVector)3 CharTypeInfo (org.apache.hadoop.hive.serde2.typeinfo.CharTypeInfo)1 ListTypeInfo (org.apache.hadoop.hive.serde2.typeinfo.ListTypeInfo)1 MapTypeInfo (org.apache.hadoop.hive.serde2.typeinfo.MapTypeInfo)1 PrimitiveTypeInfo (org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo)1 StructTypeInfo (org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo)1 TypeInfo (org.apache.hadoop.hive.serde2.typeinfo.TypeInfo)1 UnionTypeInfo (org.apache.hadoop.hive.serde2.typeinfo.UnionTypeInfo)1 VarcharTypeInfo (org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo)1 TypeDescription (org.apache.orc.TypeDescription)1