Refactor HiveSource#shouldCreateWorkunit() to accept table as parameter
Closes from aditya1105/metadata
@@ -238,7 +238,7 @@ public class HiveSource implements Source {
return;
}
- if (shouldCreateWorkunit(getCreateTime(hiveDataset.getTable()), updateTime, lowWatermark)) {
+ if (shouldCreateWorkunit(hiveDataset.getTable(), lowWatermark)) {
log.info(String.format(
"Creating workunit for table %s as updateTime %s or createTime %s is greater than low watermark %s",
@@ -384,6 +384,13 @@ public class HiveSource implements Source {
return shouldCreateWorkunit(createTime, updateTime, lowWatermark);
}
+ protected boolean shouldCreateWorkunit(Table table, LongWatermark lowWatermark)
+ throws UpdateNotFoundException {
+ long updateTime = this.updateProvider.getUpdateTime(table);
+ long createTime = getCreateTime(table);
+ return shouldCreateWorkunit(createTime, updateTime, lowWatermark);
+ }
+
/**
* Check if workunit needs to be created. Returns <code>true</code> If the
* <code>updateTime</code> is greater than the <code>lowWatermark</code> and <code>maxLookBackTime</code>
