Search in sources :

Example 1 with FilterLongColLessLongColumn

use of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterLongColLessLongColumn in project hive by apache.

the class TestVectorFilterExpressions method testFilterLongColLessLongColumn.

@Test
public void testFilterLongColLessLongColumn() throws HiveException {
    int seed = 17;
    VectorizedRowBatch vrg = VectorizedRowGroupGenUtil.getVectorizedRowBatch(5, 3, seed);
    LongColumnVector lcv0 = (LongColumnVector) vrg.cols[0];
    LongColumnVector lcv1 = (LongColumnVector) vrg.cols[1];
    LongColumnVector lcv2 = (LongColumnVector) vrg.cols[2];
    FilterLongColLessLongColumn expr = new FilterLongColLessLongColumn(2, 1);
    LongColAddLongScalar childExpr = new LongColAddLongScalar(0, 10, 2);
    expr.setChildExpressions(new VectorExpression[] { childExpr });
    // Basic case
    lcv0.vector[0] = 10;
    lcv0.vector[1] = 20;
    lcv0.vector[2] = 9;
    lcv0.vector[3] = 20;
    lcv0.vector[4] = 10;
    lcv1.vector[0] = 20;
    lcv1.vector[1] = 10;
    lcv1.vector[2] = 20;
    lcv1.vector[3] = 10;
    lcv1.vector[4] = 20;
    expr.evaluate(vrg);
    assertEquals(1, vrg.size);
    assertEquals(2, vrg.selected[0]);
}
Also used : FilterLongColLessLongColumn(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterLongColLessLongColumn) VectorizedRowBatch(org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch) LongColAddLongScalar(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.LongColAddLongScalar) LongColumnVector(org.apache.hadoop.hive.ql.exec.vector.LongColumnVector) Test(org.junit.Test)

Aggregations

LongColumnVector (org.apache.hadoop.hive.ql.exec.vector.LongColumnVector)1 VectorizedRowBatch (org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch)1 FilterLongColLessLongColumn (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterLongColLessLongColumn)1 LongColAddLongScalar (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.LongColAddLongScalar)1 Test (org.junit.Test)1