mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-10 08:21:21 +00:00
Fix bug in Dict dataset source (#816)
This commit is contained in:
parent
2e38fff984
commit
cb82e36948
@ -117,6 +117,7 @@ public class DictDatasetDao extends BaseDao {
|
|||||||
|
|
||||||
String[] urnParts = parseWhDatasetUrn(urn);
|
String[] urnParts = parseWhDatasetUrn(urn);
|
||||||
ds.setDatasetType(urnParts[0]);
|
ds.setDatasetType(urnParts[0]);
|
||||||
|
ds.setSource(urnParts[0]);
|
||||||
ds.setLocationPrefix(urnParts[1]);
|
ds.setLocationPrefix(urnParts[1]);
|
||||||
ds.setParentName(urnParts[2]);
|
ds.setParentName(urnParts[2]);
|
||||||
ds.setName(urnParts[3]);
|
ds.setName(urnParts[3]);
|
||||||
@ -161,8 +162,6 @@ public class DictDatasetDao extends BaseDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if schema is not in the MCE, will not update the source section of the dataset
|
// if schema is not in the MCE, will not update the source section of the dataset
|
||||||
String actor = getUrnEntity(toStringOrNull(auditStamp.actorUrn));
|
|
||||||
ds.setSource(actor);
|
|
||||||
int sourceTime = (int) (auditStamp.time / 1000);
|
int sourceTime = (int) (auditStamp.time / 1000);
|
||||||
if (ds.getSourceCreatedTime() == null) {
|
if (ds.getSourceCreatedTime() == null) {
|
||||||
ds.setSourceCreatedTime(sourceTime);
|
ds.setSourceCreatedTime(sourceTime);
|
||||||
|
|||||||
@ -56,7 +56,7 @@ public class DictDatasetDaoTest {
|
|||||||
dictDatasetDao.fillDictDataset(ds, urn, auditStamp, null, null, null, null, null, null);
|
dictDatasetDao.fillDictDataset(ds, urn, auditStamp, null, null, null, null, null, null);
|
||||||
|
|
||||||
assertEquals(ds.getUrn(), urn);
|
assertEquals(ds.getUrn(), urn);
|
||||||
assertEquals(ds.getSource(), null);
|
assertEquals(ds.getSource(), "oracle");
|
||||||
assertTrue(ds.getIsActive());
|
assertTrue(ds.getIsActive());
|
||||||
|
|
||||||
DatasetSchema schema = new DatasetSchema();
|
DatasetSchema schema = new DatasetSchema();
|
||||||
@ -67,7 +67,6 @@ public class DictDatasetDaoTest {
|
|||||||
|
|
||||||
dictDatasetDao.fillDictDataset(ds, urn, auditStamp, null, schema, null, null, null, null);
|
dictDatasetDao.fillDictDataset(ds, urn, auditStamp, null, schema, null, null, null, null);
|
||||||
|
|
||||||
assertEquals(ds.getSource(), "tester");
|
|
||||||
assertEquals(ds.getSourceCreatedTime().intValue(), testTime / 1000);
|
assertEquals(ds.getSourceCreatedTime().intValue(), testTime / 1000);
|
||||||
assertEquals(ds.getSourceModifiedTime().intValue(), testTime / 1000);
|
assertEquals(ds.getSourceModifiedTime().intValue(), testTime / 1000);
|
||||||
assertEquals(ds.getCreatedTime(), null);
|
assertEquals(ds.getCreatedTime(), null);
|
||||||
@ -146,7 +145,6 @@ public class DictDatasetDaoTest {
|
|||||||
|
|
||||||
Long testTime2 = System.currentTimeMillis();
|
Long testTime2 = System.currentTimeMillis();
|
||||||
auditStamp.time = testTime2;
|
auditStamp.time = testTime2;
|
||||||
auditStamp.actorUrn = "urn:li:user:tester2";
|
|
||||||
|
|
||||||
DatasetProperty property2 = new DatasetProperty();
|
DatasetProperty property2 = new DatasetProperty();
|
||||||
property2.nativeType = PlatformNativeType.TABLE;
|
property2.nativeType = PlatformNativeType.TABLE;
|
||||||
@ -165,7 +163,6 @@ public class DictDatasetDaoTest {
|
|||||||
|
|
||||||
dictDatasetDao.fillDictDataset(ds, urn, auditStamp, property2, schema, null, tags2, null, partitions);
|
dictDatasetDao.fillDictDataset(ds, urn, auditStamp, property2, schema, null, tags2, null, partitions);
|
||||||
|
|
||||||
assertEquals(ds.getSource(), "tester2");
|
|
||||||
assertEquals(ds.getSourceCreatedTime().intValue(), testTime1 / 1000);
|
assertEquals(ds.getSourceCreatedTime().intValue(), testTime1 / 1000);
|
||||||
assertEquals(ds.getSourceModifiedTime().intValue(), testTime2 / 1000);
|
assertEquals(ds.getSourceModifiedTime().intValue(), testTime2 / 1000);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user