Search in sources :

Example 1 with FilterTimestampColumnNotBetween

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

the class TestVectorFilterExpressions method testFilterTimestampNotBetween.

@Test
public void testFilterTimestampNotBetween() throws HiveException {
    VectorizedRowBatch vrb = new VectorizedRowBatch(1);
    vrb.cols[0] = new TimestampColumnVector();
    TimestampColumnVector lcv0 = (TimestampColumnVector) vrb.cols[0];
    Timestamp startTS = Timestamp.valueOf("2013-11-05 00:00:00.000000000");
    Timestamp endTS = Timestamp.valueOf("2013-11-05 00:00:00.000000010");
    Timestamp ts0 = Timestamp.valueOf("2013-11-04 00:00:00.000000000");
    lcv0.set(0, ts0);
    Timestamp ts1 = Timestamp.valueOf("2013-11-05 00:00:00.000000002");
    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 FilterTimestampColumnNotBetween(0, startTS, endTS);
    expr1.evaluate(vrb);
    assertEquals(2, vrb.size);
    assertEquals(true, vrb.selectedInUse);
    assertEquals(0, vrb.selected[0]);
    assertEquals(2, vrb.selected[1]);
}
Also used : VectorizedRowBatch(org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch) TimestampColumnVector(org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector) FilterTimestampColumnNotBetween(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterTimestampColumnNotBetween) 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 FilterTimestampColumnNotBetween (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterTimestampColumnNotBetween)1 Test (org.junit.Test)1