use of com.thinkbiganalytics.spark.dataprofiler.ProfilerConfiguration in project kylo by Teradata.
the class TimestampColumnCase2Test method accomodate.
/**
* Verify accommodating column values.
*/
@Test
public void accomodate() {
final ProfilerConfiguration profilerConfiguration = new ProfilerConfiguration();
// Test with a null value
TimestampColumnStatistics stats = new TimestampColumnStatistics(DataTypes.createStructField("ts", DataTypes.TimestampType, true), profilerConfiguration);
stats.accomodate(null, 1L);
Assert.assertNull(stats.getMaxTimestamp());
Assert.assertNull(stats.getMinTimestamp());
// Test with uninitialized max & min
stats.accomodate("2016-06-27 14:04:30", 1L);
Timestamp ts1 = new Timestamp(new DateTime(2016, 6, 27, 14, 4, 30).getMillis());
Assert.assertEquals(ts1, stats.getMaxTimestamp());
Assert.assertEquals(ts1, stats.getMinTimestamp());
// Test with a later timestamp
stats.accomodate("2016-06-27 14:04:31", 1L);
Timestamp ts2 = new Timestamp(new DateTime(2016, 6, 27, 14, 4, 31).getMillis());
Assert.assertEquals(ts2, stats.getMaxTimestamp());
Assert.assertEquals(ts1, stats.getMinTimestamp());
// Test with an earlier timestamp
stats.accomodate("2016-06-27 14:04:29", 1L);
Timestamp ts3 = new Timestamp(new DateTime(2016, 6, 27, 14, 4, 29).getMillis());
Assert.assertEquals(ts2, stats.getMaxTimestamp());
Assert.assertEquals(ts3, stats.getMinTimestamp());
}
Aggregations