This is an automated email from the ASF dual-hosted git repository. mchades pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push: new d32af61bc5 [#5545] fix(doris-catalog): Fix the problem that we can't set Doris table properties. (#6186) d32af61bc5 is described below commit d32af61bc56d902ce066cf96dde0449923a6aea5 Author: Qi Yu <y...@datastrato.com> AuthorDate: Mon Jan 13 14:58:57 2025 +0800 [#5545] fix(doris-catalog): Fix the problem that we can't set Doris table properties. (#6186) ### What changes were proposed in this pull request? Modify table properties SQL in alter table sentence to support setting table properties. ### Why are the changes needed? It's a bug. Fix: #5545 ### Does this PR introduce _any_ user-facing change? N/A. ### How was this patch tested? IT. --- .../catalog/doris/operation/DorisTableOperations.java | 17 ++++++++--------- .../catalog/doris/integration/test/CatalogDorisIT.java | 10 ++++++++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/catalogs/catalog-jdbc-doris/src/main/java/org/apache/gravitino/catalog/doris/operation/DorisTableOperations.java b/catalogs/catalog-jdbc-doris/src/main/java/org/apache/gravitino/catalog/doris/operation/DorisTableOperations.java index aa6348e2f7..829088f013 100644 --- a/catalogs/catalog-jdbc-doris/src/main/java/org/apache/gravitino/catalog/doris/operation/DorisTableOperations.java +++ b/catalogs/catalog-jdbc-doris/src/main/java/org/apache/gravitino/catalog/doris/operation/DorisTableOperations.java @@ -567,10 +567,6 @@ public class DorisTableOperations extends JdbcTableOperations { alterSql.add("MODIFY COMMENT \"" + newComment + "\""); } - if (!setProperties.isEmpty()) { - alterSql.add(generateTableProperties(setProperties)); - } - if (CollectionUtils.isEmpty(alterSql)) { return ""; } @@ -602,11 +598,14 @@ public class DorisTableOperations extends JdbcTableOperations { } private String generateTableProperties(List<TableChange.SetProperty> setProperties) { - return setProperties.stream() - .map( - setProperty -> - String.format("\"%s\" = \"%s\"", setProperty.getProperty(), setProperty.getValue())) - .collect(Collectors.joining(",\n")); + String properties = + setProperties.stream() + .map( + setProperty -> + String.format( + "\"%s\" = \"%s\"", setProperty.getProperty(), setProperty.getValue())) + .collect(Collectors.joining(",\n")); + return "set (" + properties + ")"; } private String updateColumnCommentFieldDefinition( diff --git a/catalogs/catalog-jdbc-doris/src/test/java/org/apache/gravitino/catalog/doris/integration/test/CatalogDorisIT.java b/catalogs/catalog-jdbc-doris/src/test/java/org/apache/gravitino/catalog/doris/integration/test/CatalogDorisIT.java index 9288c9616b..9d2c798ae7 100644 --- a/catalogs/catalog-jdbc-doris/src/test/java/org/apache/gravitino/catalog/doris/integration/test/CatalogDorisIT.java +++ b/catalogs/catalog-jdbc-doris/src/test/java/org/apache/gravitino/catalog/doris/integration/test/CatalogDorisIT.java @@ -577,6 +577,16 @@ public class CatalogDorisIT extends BaseIT { .pollInterval(WAIT_INTERVAL_IN_SECONDS, TimeUnit.SECONDS) .untilAsserted( () -> assertEquals(4, tableCatalog.loadTable(tableIdentifier).columns().length)); + + // set property + tableCatalog.alterTable(tableIdentifier, TableChange.setProperty("in_memory", "true")); + Awaitility.await() + .atMost(MAX_WAIT_IN_SECONDS, TimeUnit.SECONDS) + .pollInterval(WAIT_INTERVAL_IN_SECONDS, TimeUnit.SECONDS) + .untilAsserted( + () -> + assertEquals( + "true", tableCatalog.loadTable(tableIdentifier).properties().get("in_memory"))); } @Test