Search in sources :

Example 1 with VoidColumnVector

use of org.apache.hadoop.hive.ql.exec.vector.VoidColumnVector in project alluxio by Alluxio.

the class OrcRow method getColumn.

@Override
public Object getColumn(String column) {
    final Integer columnPosition = mColumnNamePosition.get(column);
    if (columnPosition == null) {
        throw new IllegalArgumentException("Invalid column name: " + column);
    }
    final ColumnVector col = mBatch.cols[columnPosition];
    if (col.isNull[mPosition]) {
        return null;
    }
    if (col instanceof TimestampColumnVector) {
        return ((TimestampColumnVector) col).asScratchTimestamp(mPosition).getTime();
    } else if (col instanceof VoidColumnVector) {
        return null;
    } else if (col instanceof DecimalColumnVector) {
        final HiveDecimal hiveDecimal = ((DecimalColumnVector) col).vector[mPosition].getHiveDecimal();
        return hiveDecimal;
    } else if (col instanceof LongColumnVector) {
        return ((LongColumnVector) col).vector[mPosition];
    } else if (col instanceof BytesColumnVector) {
        BytesColumnVector bcv = (BytesColumnVector) col;
        return Arrays.copyOfRange(bcv.vector[mPosition], bcv.start[mPosition], bcv.start[mPosition] + bcv.length[mPosition]);
    } else if (col instanceof DoubleColumnVector) {
        return ((DoubleColumnVector) col).vector[mPosition];
    }
    throw new UnsupportedOperationException("Unsupported column vector: " + col.getClass().getName());
}
Also used : TimestampColumnVector(org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector) DecimalColumnVector(org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector) DoubleColumnVector(org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector) HiveDecimal(org.apache.hadoop.hive.common.type.HiveDecimal) BytesColumnVector(org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector) VoidColumnVector(org.apache.hadoop.hive.ql.exec.vector.VoidColumnVector) LongColumnVector(org.apache.hadoop.hive.ql.exec.vector.LongColumnVector) TimestampColumnVector(org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector) DecimalColumnVector(org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector) BytesColumnVector(org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector) LongColumnVector(org.apache.hadoop.hive.ql.exec.vector.LongColumnVector) ColumnVector(org.apache.hadoop.hive.ql.exec.vector.ColumnVector) VoidColumnVector(org.apache.hadoop.hive.ql.exec.vector.VoidColumnVector) DoubleColumnVector(org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector)

Aggregations

HiveDecimal (org.apache.hadoop.hive.common.type.HiveDecimal)1 BytesColumnVector (org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector)1 ColumnVector (org.apache.hadoop.hive.ql.exec.vector.ColumnVector)1 DecimalColumnVector (org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector)1 DoubleColumnVector (org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector)1 LongColumnVector (org.apache.hadoop.hive.ql.exec.vector.LongColumnVector)1 TimestampColumnVector (org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector)1 VoidColumnVector (org.apache.hadoop.hive.ql.exec.vector.VoidColumnVector)1