use of org.apache.hadoop.hive.ql.plan.ptf.PTFExpressionDef in project hive by apache.
the class TestValueBoundaryScanner method testTimestampEquals.
@Test
public void testTimestampEquals() {
PTFExpressionDef argDef = new PTFExpressionDef();
argDef.setOI(PrimitiveObjectInspectorFactory.writableTimestampObjectInspector);
TimestampValueBoundaryScanner scanner = new TimestampValueBoundaryScanner(null, null, new OrderExpressionDef(argDef), false);
Timestamp ts = new Timestamp();
ts.setTimeInMillis(1000);
TimestampWritableV2 w1 = new TimestampWritableV2(ts);
TimestampWritableV2 w2 = new TimestampWritableV2(ts);
// empty
TimestampWritableV2 w3 = new TimestampWritableV2();
Assert.assertTrue(scanner.isEqual(w1, w2));
Assert.assertTrue(scanner.isEqual(w2, w1));
// empty == epoch
Assert.assertTrue(scanner.isEqual(w3, new TimestampWritableV2(new Timestamp())));
// empty != another non-epoch
Assert.assertFalse(scanner.isEqual(w3, w1));
Assert.assertFalse(scanner.isEqual(null, w2));
Assert.assertFalse(scanner.isEqual(w1, null));
Assert.assertTrue(scanner.isEqual(null, null));
}
Aggregations