use of org.apache.gobblin.source.extractor.extract.LongWatermark in project incubator-gobblin by apache.
the class TableLevelWatermarkerTest method testPreviousState.
@Test
public void testPreviousState() throws Exception {
WorkUnitState previousWus = new WorkUnitState();
previousWus.setProp(ConfigurationKeys.DATASET_URN_KEY, "test_table");
previousWus.setActualHighWatermark(new LongWatermark(100l));
// Watermark will be lowest of 100l and 101l
WorkUnitState previousWus1 = new WorkUnitState();
previousWus1.setProp(ConfigurationKeys.DATASET_URN_KEY, "test_table");
previousWus1.setActualHighWatermark(new LongWatermark(101l));
SourceState state = new SourceState(new State(), Lists.newArrayList(previousWus));
TableLevelWatermarker watermarker = new TableLevelWatermarker(state);
Assert.assertEquals(watermarker.getPreviousHighWatermark(mockTable("test_table")), new LongWatermark(100l));
}
use of org.apache.gobblin.source.extractor.extract.LongWatermark in project incubator-gobblin by apache.
the class TableLevelWatermarkerTest method testPreviousStateWithPartitionWatermark.
@Test
public void testPreviousStateWithPartitionWatermark() throws Exception {
WorkUnitState previousWus = new WorkUnitState();
previousWus.setProp(ConfigurationKeys.DATASET_URN_KEY, "test_table");
previousWus.setActualHighWatermark(new LongWatermark(100l));
// Watermark workunits created by PartitionLevelWatermarker need to be ignored.
WorkUnitState previousWus1 = new WorkUnitState();
previousWus1.setProp(ConfigurationKeys.DATASET_URN_KEY, "test_table");
previousWus1.setProp(PartitionLevelWatermarker.IS_WATERMARK_WORKUNIT_KEY, true);
previousWus1.setActualHighWatermark(new MultiKeyValueLongWatermark(ImmutableMap.of("part1", 200l)));
SourceState state = new SourceState(new State(), Lists.newArrayList(previousWus));
TableLevelWatermarker watermarker = new TableLevelWatermarker(state);
Assert.assertEquals(watermarker.getPreviousHighWatermark(mockTable("test_table")), new LongWatermark(100l));
}
use of org.apache.gobblin.source.extractor.extract.LongWatermark in project incubator-gobblin by apache.
the class ConversionHiveTestUtils method createWus.
public static WorkUnitState createWus(String dbName, String tableName, long watermark) {
WorkUnitState wus = new WorkUnitState();
wus.setActualHighWatermark(new LongWatermark(watermark));
wus.setProp(ConfigurationKeys.DATASET_URN_KEY, dbName + "@" + tableName);
wus.setProp(ConfigurationKeys.JOB_ID_KEY, "jobId");
return wus;
}
use of org.apache.gobblin.source.extractor.extract.LongWatermark in project incubator-gobblin by apache.
the class BackfillHiveSourceTest method testNoWhitelist.
@Test
public void testNoWhitelist() throws Exception {
BackfillHiveSource backfillHiveSource = new BackfillHiveSource();
SourceState state = new SourceState();
backfillHiveSource.initBackfillHiveSource(state);
Partition sourcePartition = Mockito.mock(Partition.class, Mockito.RETURNS_SMART_NULLS);
Assert.assertTrue(backfillHiveSource.shouldCreateWorkunit(sourcePartition, new LongWatermark(0)));
}
use of org.apache.gobblin.source.extractor.extract.LongWatermark in project incubator-gobblin by apache.
the class GoogleWebmasterExtractorTest method getWorkUnitState1.
public static WorkUnitState getWorkUnitState1() {
WorkUnit wu = new WorkUnit(new Extract(Extract.TableType.APPEND_ONLY, "namespace", "table"));
wu.setWatermarkInterval(new WatermarkInterval(new LongWatermark(20160101235959L), new LongWatermark(20160102235959L)));
State js = new State();
return new WorkUnitState(wu, js);
}
Aggregations