diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/EntityRepository.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/EntityRepository.java index 742d0f5f854..e3f72b0e7c9 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/EntityRepository.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/EntityRepository.java @@ -442,7 +442,7 @@ public abstract class EntityRepository { entitySpecificUpdate(); // Store the updated entity - store(); + storeUpdate(); } public void entitySpecificUpdate() throws IOException { @@ -588,7 +588,7 @@ public abstract class EntityRepository { } } - public final void store() throws IOException, ParseException { + public final void storeUpdate() throws IOException, ParseException { if (updateVersion(original.getVersion())) { // Store the old version String extensionName = EntityUtil.getVersionExtension(entityName, original.getVersion()); diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/TableRepository.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/TableRepository.java index bcc78981e0f..8467c514c5f 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/TableRepository.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/TableRepository.java @@ -349,7 +349,6 @@ public class TableRepository extends EntityRepository { // Add column level tags by adding tag to column relationship for (Column column : columns) { EntityUtil.applyTags(dao.tagDAO(), column.getTags(), column.getFullyQualifiedName()); - column.setTags(getTags(column.getFullyQualifiedName())); // Update tag list to handle derived tags if (column.getChildren() != null) { applyTags(column.getChildren()); } @@ -359,7 +358,6 @@ public class TableRepository extends EntityRepository
{ private void applyTags(Table table) throws IOException { // Add table level tags by adding tag to table relationship EntityUtil.applyTags(dao.tagDAO(), table.getTags(), table.getFullyQualifiedName()); - table.setTags(getTags(table.getFullyQualifiedName())); // Update tag to handle additional derived tags applyTags(table.getColumns()); } @@ -741,7 +739,7 @@ public class TableRepository extends EntityRepository
{ // Delete tags related to deleted columns deletedColumns.forEach(deleted -> EntityUtil.removeTags(dao.tagDAO(), deleted.getFullyQualifiedName())); - // Add tags related to deleted columns + // Add tags related to newly added columns for (Column added : addedColumns) { EntityUtil.applyTags(dao.tagDAO(), added.getTags(), added.getFullyQualifiedName()); } @@ -755,8 +753,8 @@ public class TableRepository extends EntityRepository
{ } updateColumnDescription(stored, updated); - updateTags(stored.getFullyQualifiedName(), fieldName + "." + updated.getName() + ".tags", stored.getTags(), - updated.getTags()); + updateTags(stored.getFullyQualifiedName(), fieldName + "." + updated.getName() + ".tags", + stored.getTags(), updated.getTags()); updateColumnConstraint(stored, updated); if (updated.getChildren() != null && stored.getChildren() != null) { @@ -765,9 +763,7 @@ public class TableRepository extends EntityRepository
{ } } - if (!deletedColumns.isEmpty()) { - majorVersionChange = true; - } + majorVersionChange = !deletedColumns.isEmpty(); } private void updateColumnDescription(Column origColumn, Column updatedColumn) throws JsonProcessingException { diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/util/EntityUtil.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/util/EntityUtil.java index a431ced2591..4716f26355a 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/util/EntityUtil.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/util/EntityUtil.java @@ -91,8 +91,7 @@ public final class EntityUtil { public static BiPredicate taskMatch = (task1, task2) -> task1.getName().equals(task2.getName()); - public static BiPredicate stringMatch = (string1, string2) -> - string1.equals(string2); + public static BiPredicate stringMatch = String::equals; public static BiPredicate columnMatch = (column1, column2) -> column1.getName().equals(column2.getName()) && @@ -285,10 +284,6 @@ public final class EntityUtil { // Apply tagLabel to targetFQN that identifies an entity or field tagDAO.applyTag(tagLabel.getTagFQN(), targetFQN, tagLabel.getLabelType().ordinal(), tagLabel.getState().ordinal()); - - // Apply derived tags - List derivedTags = getDerivedTags(tagDAO, tagLabel, tag); - applyTags(tagDAO, derivedTags, targetFQN); } } diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/EntityResourceTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/EntityResourceTest.java index a462fa407e1..75d6aa06f6c 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/EntityResourceTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/EntityResourceTest.java @@ -646,7 +646,6 @@ public abstract class EntityResourceTest extends CatalogApplicationTest { protected final T createAndCheckEntity(Object create, Map authHeaders) throws IOException { // Validate an entity that is created has all the information set in create request String updatedBy = TestUtils.getPrincipal(authHeaders); - // aqui si que tenim HREF T entity = createEntity(create, authHeaders); EntityInterface entityInterface = getEntityInterface(entity); diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/databases/TableResourceTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/databases/TableResourceTest.java index 46f67cc2403..ac6dcb4d019 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/databases/TableResourceTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/databases/TableResourceTest.java @@ -119,11 +119,7 @@ public class TableResourceTest extends EntityResourceTest
{ private static final Logger LOG = LoggerFactory.getLogger(TableResourceTest.class); public static Database DATABASE; - public static final List COLUMNS = Arrays.asList( - getColumn("c1", BIGINT, USER_ADDRESS_TAG_LABEL), - getColumn("c2", ColumnDataType.VARCHAR, USER_ADDRESS_TAG_LABEL).withDataLength(10), - getColumn("c3", BIGINT, USER_BANK_ACCOUNT_TAG_LABEL)); - + public static List COLUMNS; public TableResourceTest() { super(Entity.TABLE, Table.class, TableList.class, "tables", TableResource.FIELDS, @@ -135,6 +131,11 @@ public class TableResourceTest extends EntityResourceTest
{ EntityResourceTest.setup(test); CreateDatabase create = DatabaseResourceTest.create(test).withService(SNOWFLAKE_REFERENCE); DATABASE = createAndCheckDatabase(create, adminAuthHeaders()); + + COLUMNS = Arrays.asList( + getColumn("c1", BIGINT, USER_ADDRESS_TAG_LABEL), + getColumn("c2", ColumnDataType.VARCHAR, USER_ADDRESS_TAG_LABEL).withDataLength(10), + getColumn("c3", BIGINT, USER_BANK_ACCOUNT_TAG_LABEL)); } public static Table createTable(TestInfo test, int i) throws IOException {