From 79dc6c04cea736789468bf065228a09380cd4272 Mon Sep 17 00:00:00 2001 From: LXW <1264174498@qq.com> Date: Sat, 21 Sep 2024 12:27:32 +0800 Subject: [PATCH] (improvement)(chat) Avoid occasional npe when obtaining recommended dimensions (#1693) Co-authored-by: lxwcodemonkey --- .../interceptor/DefaultAuthenticationInterceptor.java | 1 - .../server/processor/execute/DimensionRecommendProcessor.java | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/auth/authentication/src/main/java/com/tencent/supersonic/auth/authentication/interceptor/DefaultAuthenticationInterceptor.java b/auth/authentication/src/main/java/com/tencent/supersonic/auth/authentication/interceptor/DefaultAuthenticationInterceptor.java index b0bdbcd1d..13cd6755e 100644 --- a/auth/authentication/src/main/java/com/tencent/supersonic/auth/authentication/interceptor/DefaultAuthenticationInterceptor.java +++ b/auth/authentication/src/main/java/com/tencent/supersonic/auth/authentication/interceptor/DefaultAuthenticationInterceptor.java @@ -2,7 +2,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - import com.tencent.supersonic.auth.api.authentication.annotation.AuthenticationIgnore; import com.tencent.supersonic.auth.api.authentication.config.AuthenticationConfig; import com.tencent.supersonic.auth.api.authentication.pojo.User; diff --git a/chat/server/src/main/java/com/tencent/supersonic/chat/server/processor/execute/DimensionRecommendProcessor.java b/chat/server/src/main/java/com/tencent/supersonic/chat/server/processor/execute/DimensionRecommendProcessor.java index 19cabdcfd..ee86e7cf4 100644 --- a/chat/server/src/main/java/com/tencent/supersonic/chat/server/processor/execute/DimensionRecommendProcessor.java +++ b/chat/server/src/main/java/com/tencent/supersonic/chat/server/processor/execute/DimensionRecommendProcessor.java @@ -46,6 +46,9 @@ public void process(ExecuteContext executeContext, QueryResult queryResult) { private List getDimensions(Long metricId, Long dataSetId) { SemanticLayerService semanticService = ContextUtils.getBean(SemanticLayerService.class); DataSetSchema dataSetSchema = semanticService.getDataSetSchema(dataSetId); + if (dataSetSchema == null) { + return Lists.newArrayList(); + } List drillDownDimensions = Lists.newArrayList(); Set metricElements = dataSetSchema.getMetrics(); if (!CollectionUtils.isEmpty(metricElements)) {