From c3113ffcba2e8c7b507eb1f1ef5f66d515be42b6 Mon Sep 17 00:00:00 2001 From: Sriharsha Chintalapani Date: Fri, 17 Dec 2021 09:32:34 -0800 Subject: [PATCH] Fix #1822: ES live updates are failing when description is null (#1823) --- .../ElasticSearchIndexDefinition.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/elasticsearch/ElasticSearchIndexDefinition.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/elasticsearch/ElasticSearchIndexDefinition.java index 2ea3a5e096f..e7146e66fdd 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/elasticsearch/ElasticSearchIndexDefinition.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/elasticsearch/ElasticSearchIndexDefinition.java @@ -322,7 +322,7 @@ class TableESIndex extends ElasticSearchIndex { public static TableESIndexBuilder builder(Table table, int responseCode) { String tableId = table.getId().toString(); String tableName = table.getName(); - String description = table.getDescription(); + String description = table.getDescription() != null ? table.getDescription() : ""; List tags = new ArrayList<>(); List columnNames = new ArrayList<>(); List columnDescriptions = new ArrayList<>(); @@ -469,12 +469,14 @@ class TopicESIndex extends ElasticSearchIndex { } ParseTags parseTags = new ParseTags(tags); Long updatedTimestamp = topic.getUpdatedAt().getTime(); + String description = topic.getDescription() != null ? topic.getDescription() : ""; + String displayName = topic.getDisplayName() != null ? topic.getDisplayName() : ""; TopicESIndexBuilder topicESIndexBuilder = internalBuilder() .topicId(topic.getId().toString()) .name(topic.getName()) - .displayName(topic.getDisplayName()) - .description(topic.getDescription()) + .displayName(displayName) + .description(description) .fqdn(topic.getFullyQualifiedName()) .lastUpdatedTimestamp(updatedTimestamp) .suggest(suggest) @@ -565,12 +567,14 @@ class DashboardESIndex extends ElasticSearchIndex { chartDescriptions.add(chart.getDescription()); } ParseTags parseTags = new ParseTags(tags); + String description = dashboard.getDescription() != null ? dashboard.getDescription() : ""; + String displayName = dashboard.getDisplayName() != null ? dashboard.getDisplayName() : ""; DashboardESIndexBuilder dashboardESIndexBuilder = internalBuilder() .dashboardId(dashboard.getId().toString()) .name(dashboard.getDisplayName()) - .displayName(dashboard.getDisplayName()) - .description(dashboard.getDescription()) + .displayName(displayName) + .description(description) .fqdn(dashboard.getFullyQualifiedName()) .lastUpdatedTimestamp(updatedTimestamp) .chartNames(chartNames) @@ -651,12 +655,14 @@ class PipelineESIndex extends ElasticSearchIndex { } Long updatedTimestamp = pipeline.getUpdatedAt().getTime(); ParseTags parseTags = new ParseTags(tags); + String description = pipeline.getDescription() != null ? pipeline.getDescription() : ""; + String displayName = pipeline.getDisplayName() != null ? pipeline.getDisplayName() : ""; PipelineESIndexBuilder pipelineESIndexBuilder = internalBuilder() .pipelineId(pipeline.getId().toString()) .name(pipeline.getDisplayName()) - .displayName(pipeline.getDisplayName()) - .description(pipeline.getDescription()) + .displayName(description) + .description(displayName) .fqdn(pipeline.getFullyQualifiedName()) .lastUpdatedTimestamp(updatedTimestamp) .taskNames(taskNames)