You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by xx...@apache.org on 2022/12/16 07:01:42 UTC
[kylin] 11/15: KYLIN-5364 Support case-insensitive when using table reloading api
This is an automated email from the ASF dual-hosted git repository.
xxyu pushed a commit to branch kylin5
in repository https://gitbox.apache.org/repos/asf/kylin.git
commit 03c6a0f4ea53de09b17f54109d844e3b8a8c6518
Author: Xinglong Li <xi...@kyligence.io>
AuthorDate: Fri Sep 30 17:30:28 2022 +0800
KYLIN-5364 Support case-insensitive when using table reloading api
Co-authored-by: Xinglong.Li <xi...@kyligence.io>
---
.../java/org/apache/kylin/rest/service/TableService.java | 4 ++--
.../apache/kylin/rest/service/TableReloadServiceTest.java | 14 ++++++++++++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/datasource-service/src/main/java/org/apache/kylin/rest/service/TableService.java b/src/datasource-service/src/main/java/org/apache/kylin/rest/service/TableService.java
index fe8e38292e..f4c94be684 100644
--- a/src/datasource-service/src/main/java/org/apache/kylin/rest/service/TableService.java
+++ b/src/datasource-service/src/main/java/org/apache/kylin/rest/service/TableService.java
@@ -1072,9 +1072,9 @@ public class TableService extends BasicService {
public OpenPreReloadTableResponse preProcessBeforeReloadWithoutFailFast(String project, String tableIdentity,
boolean needDetails) throws Exception {
+ Preconditions.checkNotNull(tableIdentity, "table identity can not be null");
aclEvaluate.checkProjectWritePermission(project);
-
- val context = calcReloadContext(project, tableIdentity, false);
+ val context = calcReloadContext(project, tableIdentity.toUpperCase(Locale.ROOT), false);
removeFusionModelBatchPart(project, context);
PreReloadTableResponse preReloadTableResponse = preProcessBeforeReloadWithContext(project, context, needDetails);
diff --git a/src/modeling-service/src/test/java/org/apache/kylin/rest/service/TableReloadServiceTest.java b/src/modeling-service/src/test/java/org/apache/kylin/rest/service/TableReloadServiceTest.java
index 91e1b2a83e..b252929a93 100644
--- a/src/modeling-service/src/test/java/org/apache/kylin/rest/service/TableReloadServiceTest.java
+++ b/src/modeling-service/src/test/java/org/apache/kylin/rest/service/TableReloadServiceTest.java
@@ -226,6 +226,20 @@ public class TableReloadServiceTest extends CSVSourceTestCase {
Assert.assertEquals("BIGINT", model.getComputedColumnDescs().get(0).getDatatype());
}
+ @Test
+ public void testPreProcess_UseCaseSensitiveTableIdentity() throws Exception {
+ NTableMetadataManager manager = NTableMetadataManager.getInstance(getTestConfig(), PROJECT);
+ TableDesc tableDesc = manager.getTableDesc("DEFAULT.TEST_KYLIN_FACT");
+ Assert.assertNotNull(tableDesc);
+ val response = tableService.preProcessBeforeReloadWithoutFailFast(PROJECT, "DEFAULT.TEST_KYLIN_FAct", false);
+ Assert.assertFalse(response.isHasDatasourceChanged());
+
+ // test table identity is null
+ thrown.expect(NullPointerException.class);
+ thrown.expectMessage("table identity can not be null");
+ tableService.preProcessBeforeReloadWithoutFailFast(PROJECT, null, false);
+ }
+
private void dropModelWhen(Predicate<String> predicate) {
modelService.listAllModelIdsInProject(PROJECT).stream().filter(predicate)
.forEach(id -> modelService.innerDropModel(id, PROJECT));