use of org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector in project hive by apache.
the class RecordReaderImpl method nextDouble.
static DoubleWritable nextDouble(ColumnVector vector, int row, Object previous) {
if (vector.isRepeating) {
row = 0;
}
if (vector.noNulls || !vector.isNull[row]) {
DoubleWritable result;
if (previous == null || previous.getClass() != DoubleWritable.class) {
result = new DoubleWritable();
} else {
result = (DoubleWritable) previous;
}
result.set(((DoubleColumnVector) vector).vector[row]);
return result;
} else {
return null;
}
}
use of org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector in project hive by apache.
the class TestVectorMathFunctions method getVectorizedRowBatchLongInDoubleOut.
public static VectorizedRowBatch getVectorizedRowBatchLongInDoubleOut() {
VectorizedRowBatch batch = new VectorizedRowBatch(2);
LongColumnVector lcv;
DoubleColumnVector dcv;
lcv = new LongColumnVector();
dcv = new DoubleColumnVector();
lcv.vector[0] = -2;
lcv.vector[1] = -1;
lcv.vector[2] = 0;
lcv.vector[3] = 1;
lcv.vector[4] = 2;
batch.cols[0] = lcv;
batch.cols[1] = dcv;
batch.size = 5;
return batch;
}
use of org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector 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.DoubleColumnVector in project hive by apache.
the class TestVectorMathFunctions method testVectorCos.
@Test
public void testVectorCos() {
VectorizedRowBatch b = getVectorizedRowBatchDoubleInDoubleOut();
DoubleColumnVector resultV = (DoubleColumnVector) b.cols[1];
b.cols[0].noNulls = true;
VectorExpression expr = new FuncCosDoubleToDouble(0, 1);
expr.evaluate(b);
Assert.assertEquals(Math.cos(0.5d), resultV.vector[4]);
}
use of org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector 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;
}
Aggregations