rkundam commented on code in PR #662:
URL: https://github.com/apache/atlas/pull/662#discussion_r3399465593
##########
repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java:
##########
@@ -170,12 +169,11 @@ private void
updateCollectionWithDifferingAttributes(List<AtlasStructDef.AtlasAt
if (relationshipType == null) {
difference.add(incoming);
}
- } else {
- if
(!existingAttribute.getTypeName().equals(incoming.getTypeName())) {
- LOG.error("Attribute definition difference found: {}, {}",
existingAttribute, incoming);
+ } else if
(!existingAttribute.getTypeName().equals(incoming.getTypeName())) {
+ LOG.info("Attribute type changed for {}.{}: {} -> {}; updating
typedef during import",
+ existing.getName(), incoming.getName(),
existingAttribute.getTypeName(), incoming.getTypeName());
Review Comment:
Is incoming.getName() intentional? If incoming and existing have the same
name, should this be existing.getName().existingAttribute.getName() instead?
##########
repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java:
##########
@@ -364,21 +364,18 @@ public void importGlossary(InputStream inputStream)
throws IOException, AtlasBas
assertEntityCount("AtlasGlossaryTerm",
"105533b6-c125-4a87-bed5-cdf67fb68c39", 1);
}
- @Test(dataProvider = "hdfs_path1", expectedExceptions =
AtlasBaseException.class)
+ @Test(dataProvider = "hdfs_path1")
public void importHdfs_path1(InputStream inputStream) throws IOException,
AtlasBaseException {
loadBaseModel();
loadFsModel();
loadModelFromResourcesJson("tag1.json", typeDefStore, typeRegistry);
- try {
- runImportWithNoParameters(importService, inputStream);
- } catch (AtlasBaseException e) {
- assertEquals(e.getAtlasErrorCode(),
AtlasErrorCode.INVALID_IMPORT_ATTRIBUTE_TYPE_CHANGED);
- AtlasClassificationType tag1 =
typeRegistry.getClassificationTypeByName("tag1");
- assertNotNull(tag1);
- assertEquals(tag1.getAllAttributes().size(), 2);
- throw e;
- }
+ runImportWithNoParameters(importService, inputStream);
+
+ AtlasClassificationType tag1 =
typeRegistry.getClassificationTypeByName("tag1");
+ assertNotNull(tag1);
+
assertEquals(tag1.getAttribute("attrib1").getAttributeDef().getTypeName(),
"string");
+ assertNotNull(tag1.getAttribute("attrib2"));
Review Comment:
Is attrib2 valid attribute name as tag1.json has two attributes attrib1 &
attrib3?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]