Search in sources :

Example 1 with FilterTimestampColumnBetween

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

the class TestVectorFilterExpressions method testFilterTimestampBetween.

@Test
public void testFilterTimestampBetween() {
    VectorizedRowBatch vrb = new VectorizedRowBatch(1);
    vrb.cols[0] = new TimestampColumnVector();
    TimestampColumnVector lcv0 = (TimestampColumnVector) vrb.cols[0];
    // the epoch
    Timestamp startTS = new Timestamp(0);
    Timestamp endTS = Timestamp.valueOf("2013-11-05 00:00:00.000000000");
    Timestamp ts0 = Timestamp.valueOf("1963-11-06 00:00:00.000");
    lcv0.set(0, ts0);
    Timestamp ts1 = Timestamp.valueOf("1983-11-06 00:00:00.000");
    lcv0.set(1, ts1);
    Timestamp ts2 = Timestamp.valueOf("2099-11-06 00:00:00.000");
    lcv0.set(2, ts2);
    vrb.size = 3;
    VectorExpression expr1 = new FilterTimestampColumnBetween(0, startTS, endTS);
    expr1.evaluate(vrb);
    assertEquals(1, vrb.size);
    assertEquals(true, vrb.selectedInUse);
    assertEquals(1, vrb.selected[0]);
}
Also used : VectorizedRowBatch(org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch) TimestampColumnVector(org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector) FilterTimestampColumnBetween(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterTimestampColumnBetween) Timestamp(java.sql.Timestamp) Test(org.junit.Test)

Aggregations

Timestamp (java.sql.Timestamp)1 TimestampColumnVector (org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector)1 VectorizedRowBatch (org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch)1 FilterTimestampColumnBetween (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterTimestampColumnBetween)1 Test (org.junit.Test)1