Skip to content

Commit

Permalink
GEN-1434: Improvement : Show displayName for database and databaseSch…
Browse files Browse the repository at this point in the history
…ema in explore tree (#17876)

* Show displayName for database and databaseSchema in explore tree

* use display name for database and schema

* add playwright

* resync indexes of dataAssets based on database & databaseSchema displayName change

---------

Co-authored-by: karanh37 <karanh37@gmail.com>
Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
(cherry picked from commit a99fbb2)
  • Loading branch information
sonika-shah authored and karanh37 committed Sep 27, 2024
1 parent 3e5cc92 commit 83de4a1
Show file tree
Hide file tree
Showing 20 changed files with 239 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.csv.CSVPrinter;
Expand Down Expand Up @@ -105,6 +106,18 @@ public EntityInterface getParentEntity(Database entity, String fields) {
return Entity.getEntity(entity.getService(), fields, Include.ALL);
}

@Override
public void entityRelationshipReindex(Database original, Database updated) {
super.entityRelationshipReindex(original, updated);

// Update search indexes of assets and entity on database displayName change
if (!Objects.equals(original.getDisplayName(), updated.getDisplayName())) {
searchRepository
.getSearchClient()
.reindexAcrossIndices("database.fullyQualifiedName", original.getEntityReference());
}
}

@Override
public String exportToCsv(String name, String user) throws IOException {
Database database = getByName(null, name, Fields.EMPTY_FIELDS); // Validate database name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.csv.CSVPrinter;
Expand Down Expand Up @@ -179,6 +180,18 @@ private void populateDatabase(DatabaseSchema schema) {
.withServiceType(database.getServiceType());
}

@Override
public void entityRelationshipReindex(DatabaseSchema original, DatabaseSchema updated) {
super.entityRelationshipReindex(original, updated);

// Update search indexes of assets and entity on databaseSchema displayName change
if (!Objects.equals(original.getDisplayName(), updated.getDisplayName())) {
searchRepository
.getSearchClient()
.reindexAcrossIndices("databaseSchema.fullyQualifiedName", original.getEntityReference());
}
}

@Override
public String exportToCsv(String name, String user) throws IOException {
DatabaseSchema schema = getByName(null, name, Fields.EMPTY_FIELDS); // Validate database schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,14 @@ private static SearchSourceBuilder buildSearchAcrossIndexesBuilder(
AggregationBuilders.terms("databaseSchema.name.keyword")
.field("databaseSchema.name.keyword")
.size(MAX_AGGREGATE_SIZE));
searchSourceBuilder.aggregation(
AggregationBuilders.terms("database.displayName")
.field("database.displayName")
.size(MAX_AGGREGATE_SIZE));
searchSourceBuilder.aggregation(
AggregationBuilders.terms("databaseSchema.displayName")
.field("databaseSchema.displayName")
.size(MAX_AGGREGATE_SIZE));
return addAggregation(searchSourceBuilder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,14 @@ private static SearchSourceBuilder buildSearchAcrossIndexesBuilder(
AggregationBuilders.terms("databaseSchema.name.keyword")
.field("databaseSchema.name.keyword")
.size(MAX_AGGREGATE_SIZE));
searchSourceBuilder.aggregation(
AggregationBuilders.terms("database.displayName")
.field("database.displayName")
.size(MAX_AGGREGATE_SIZE));
searchSourceBuilder.aggregation(
AggregationBuilders.terms("databaseSchema.displayName")
.field("databaseSchema.displayName")
.size(MAX_AGGREGATE_SIZE));
return addAggregation(searchSourceBuilder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
Expand Down Expand Up @@ -235,6 +236,7 @@
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
Expand Down Expand Up @@ -240,6 +241,7 @@
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down Expand Up @@ -228,6 +238,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
Expand Down Expand Up @@ -211,6 +212,7 @@
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down Expand Up @@ -204,6 +214,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,8 @@ test.describe('Advanced Search', { tag: '@advanced-search' }, () => {
tierTag2.responseData.fullyQualifiedName,
],
'service.displayName.keyword': [table1.service.name, table2.service.name],
'database.displayName.keyword': [
table1.database.name,
table2.database.name,
],
'databaseSchema.displayName.keyword': [
table1.schema.name,
table2.schema.name,
],
'database.displayName': [table1.database.name, table2.database.name],
'databaseSchema.displayName': [table1.schema.name, table2.schema.name],
'columns.name.keyword': ['email', 'shop_id'],
};

Expand Down
Loading

0 comments on commit 83de4a1

Please sign in to comment.