Search in sources :

Example 1 with FilterStringScalarGreaterStringGroupColumn

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

the class TestVectorStringExpressions method testStringScalarCompareStringCol.

@Test
public // Test string literal to string column comparison
void testStringScalarCompareStringCol() {
    VectorizedRowBatch batch = makeStringBatch();
    VectorExpression expr;
    expr = new FilterStringScalarEqualStringGroupColumn(red2, 0);
    expr.evaluate(batch);
    // only red qualifies, and it's in entry 0
    Assert.assertTrue(batch.size == 1);
    Assert.assertTrue(batch.selected[0] == 0);
    batch = makeStringBatch();
    expr = new FilterStringScalarGreaterStringGroupColumn(red2, 0);
    expr.evaluate(batch);
    // only green qualifies, and it's in entry 1
    Assert.assertTrue(batch.size == 1);
    Assert.assertTrue(batch.selected[0] == 1);
    batch = makeStringBatch();
    expr = new FilterStringScalarLessEqualStringGroupColumn(green, 0);
    expr.evaluate(batch);
    // green and red qualify
    Assert.assertTrue(batch.size == 2);
    Assert.assertTrue(batch.selected[0] == 0);
    Assert.assertTrue(batch.selected[1] == 1);
}
Also used : VectorizedRowBatch(org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch) FilterStringScalarEqualStringGroupColumn(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringScalarEqualStringGroupColumn) FilterStringScalarGreaterStringGroupColumn(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringScalarGreaterStringGroupColumn) FilterStringScalarLessEqualStringGroupColumn(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringScalarLessEqualStringGroupColumn) Test(org.junit.Test)

Aggregations

VectorizedRowBatch (org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch)1 FilterStringScalarEqualStringGroupColumn (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringScalarEqualStringGroupColumn)1 FilterStringScalarGreaterStringGroupColumn (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringScalarGreaterStringGroupColumn)1 FilterStringScalarLessEqualStringGroupColumn (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringScalarLessEqualStringGroupColumn)1 Test (org.junit.Test)1