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;
}
}
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);
}
}
}
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;
}
}
Aggregations