use of org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector in project hive by apache.
the class RecordReaderImpl method nextTimestamp.
static TimestampWritable nextTimestamp(ColumnVector vector, int row, Object previous) {
if (vector.isRepeating) {
row = 0;
}
if (vector.noNulls || !vector.isNull[row]) {
TimestampWritable result;
if (previous == null || previous.getClass() != TimestampWritable.class) {
result = new TimestampWritable();
} else {
result = (TimestampWritable) previous;
}
TimestampColumnVector tcv = (TimestampColumnVector) vector;
result.setInternal(tcv.time[row], tcv.nanos[row]);
return result;
} else {
return null;
}
}
use of org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector in project hive by apache.
the class TestVectorMathFunctions method getVectorizedRowBatchTimestampInDoubleOut.
public static VectorizedRowBatch getVectorizedRowBatchTimestampInDoubleOut(double[] doubleValues) {
Random r = new Random(45993);
VectorizedRowBatch batch = new VectorizedRowBatch(2);
TimestampColumnVector tcv;
DoubleColumnVector dcv;
tcv = new TimestampColumnVector(doubleValues.length);
dcv = new DoubleColumnVector(doubleValues.length);
for (int i = 0; i < doubleValues.length; i++) {
doubleValues[i] = r.nextDouble() % (double) SECONDS_LIMIT;
dcv.vector[i] = doubleValues[i];
}
batch.cols[0] = tcv;
batch.cols[1] = dcv;
batch.size = doubleValues.length;
return batch;
}
use of org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector in project hive by apache.
the class TestVectorMathFunctions method getVectorizedRowBatchDoubleInTimestampOut.
public static VectorizedRowBatch getVectorizedRowBatchDoubleInTimestampOut() {
VectorizedRowBatch batch = new VectorizedRowBatch(2);
TimestampColumnVector tcv;
DoubleColumnVector dcv;
tcv = new TimestampColumnVector();
dcv = new DoubleColumnVector();
dcv.vector[0] = -1.5d;
dcv.vector[1] = -0.5d;
dcv.vector[2] = -0.1d;
dcv.vector[3] = 0d;
dcv.vector[4] = 0.5d;
dcv.vector[5] = 0.7d;
dcv.vector[6] = 1.5d;
batch.cols[0] = dcv;
batch.cols[1] = tcv;
batch.size = 7;
return batch;
}
use of org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector in project hive by apache.
the class TestVectorMathFunctions method getVectorizedRowBatchLongInTimestampOut.
public static VectorizedRowBatch getVectorizedRowBatchLongInTimestampOut(long[] longValues) {
Random r = new Random(12099);
VectorizedRowBatch batch = new VectorizedRowBatch(2);
LongColumnVector inV;
TimestampColumnVector outV;
inV = new LongColumnVector();
outV = new TimestampColumnVector();
for (int i = 0; i < longValues.length; i++) {
longValues[i] = r.nextLong() % SECONDS_LIMIT;
inV.vector[i] = longValues[i];
}
batch.cols[0] = inV;
batch.cols[1] = outV;
batch.size = longValues.length;
return batch;
}
use of org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector in project hive by apache.
the class BatchToRowReader method nextTimestamp.
public static TimestampWritable nextTimestamp(ColumnVector vector, int row, Object previous) {
if (vector.isRepeating) {
row = 0;
}
if (vector.noNulls || !vector.isNull[row]) {
TimestampWritable result;
if (previous == null || previous.getClass() != TimestampWritable.class) {
result = new TimestampWritable();
} else {
result = (TimestampWritable) previous;
}
TimestampColumnVector tcv = (TimestampColumnVector) vector;
result.setInternal(tcv.time[row], tcv.nanos[row]);
return result;
} else {
return null;
}
}
Aggregations