This is an automated email from the ASF dual-hosted git repository.
hongshun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fluss.git
The following commit(s) were added to refs/heads/main by this push:
new 3b9506516 [server] return all invalid option in err msg of
InvalidAlterTableException. (#2897)
3b9506516 is described below
commit 3b9506516458d4fa8aa56b4c459940ec6a1fb1d3
Author: Hongshun Wang <[email protected]>
AuthorDate: Mon Mar 23 10:14:22 2026 +0800
[server] return all invalid option in err msg of
InvalidAlterTableException. (#2897)
---
.../fluss/client/table/LakeEnableTableITCase.java | 3 +-
.../fluss/flink/catalog/FlinkCatalogITCase.java | 28 ++++++--------
.../server/utils/TableDescriptorValidation.java | 43 ++++++++++++++--------
3 files changed, 40 insertions(+), 34 deletions(-)
diff --git
a/fluss-client/src/test/java/org/apache/fluss/client/table/LakeEnableTableITCase.java
b/fluss-client/src/test/java/org/apache/fluss/client/table/LakeEnableTableITCase.java
index d1d663d1b..f4488774e 100644
---
a/fluss-client/src/test/java/org/apache/fluss/client/table/LakeEnableTableITCase.java
+++
b/fluss-client/src/test/java/org/apache/fluss/client/table/LakeEnableTableITCase.java
@@ -108,8 +108,7 @@ class LakeEnableTableITCase extends
ClientToServerITCaseBase {
.cause()
.isInstanceOf(InvalidAlterTableException.class)
.hasMessageContaining(
- "The option 'table.datalake.enabled' cannot be altered
for tables that were"
- + " created before the Fluss cluster enabled
datalake.");
+ "The following options cannot be altered for tables
that were created before the Fluss cluster enabled datalake:
'table.datalake.enabled'.");
}
@Test
diff --git
a/fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/catalog/FlinkCatalogITCase.java
b/fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/catalog/FlinkCatalogITCase.java
index 8f3ed9d3c..638229d8f 100644
---
a/fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/catalog/FlinkCatalogITCase.java
+++
b/fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/catalog/FlinkCatalogITCase.java
@@ -250,45 +250,39 @@ abstract class FlinkCatalogITCase {
// alter table set an unsupported modification option should throw
exception
String unSupportedDml1 =
- "alter table test_alter_table_append_only set
('table.auto-partition.enabled' = 'true')";
+ "alter table test_alter_table_append_only set
('table.auto-partition.enabled' = 'true', 'table.kv.format' = 'indexed')";
assertThatThrownBy(() -> tEnv.executeSql(unSupportedDml1))
.rootCause()
.isInstanceOf(InvalidAlterTableException.class)
- .hasMessage(
- "The option 'table.auto-partition.enabled' is not
supported to alter yet.");
+ .hasMessageContaining("The following options are not supported
to alter yet:")
+ .hasMessageContaining("table.kv.format")
+ .hasMessageContaining("table.auto-partition.enabled");
String unSupportedDml2 =
- "alter table test_alter_table_append_only set ('k1' = 'v1',
'table.kv.format' = 'indexed')";
- assertThatThrownBy(() -> tEnv.executeSql(unSupportedDml2))
- .rootCause()
- .isInstanceOf(InvalidAlterTableException.class)
- .hasMessage("The option 'table.kv.format' is not supported to
alter yet.");
-
- String unSupportedDml3 =
"alter table test_alter_table_append_only set ('bucket.num' =
'1000')";
- assertThatThrownBy(() -> tEnv.executeSql(unSupportedDml3))
+ assertThatThrownBy(() -> tEnv.executeSql(unSupportedDml2))
.rootCause()
.isInstanceOf(CatalogException.class)
.hasMessage("The option 'bucket.num' is not supported to alter
yet.");
- String unSupportedDml4 =
+ String unSupportedDml3 =
"alter table test_alter_table_append_only set ('bucket.key' =
'a')";
- assertThatThrownBy(() -> tEnv.executeSql(unSupportedDml4))
+ assertThatThrownBy(() -> tEnv.executeSql(unSupportedDml3))
.rootCause()
.isInstanceOf(CatalogException.class)
.hasMessage("The option 'bucket.key' is not supported to alter
yet.");
- String unSupportedDml5 =
+ String unSupportedDml4 =
"alter table test_alter_table_append_only reset
('bootstrap.servers')";
- assertThatThrownBy(() -> tEnv.executeSql(unSupportedDml5))
+ assertThatThrownBy(() -> tEnv.executeSql(unSupportedDml4))
.rootCause()
.isInstanceOf(CatalogException.class)
.hasMessage("The option 'bootstrap.servers' is not supported
to alter yet.");
- String unSupportedDml6 =
+ String unSupportedDml5 =
"alter table test_alter_table_append_only set
('auto-increment.fields' = 'b')";
- assertThatThrownBy(() -> tEnv.executeSql(unSupportedDml6))
+ assertThatThrownBy(() -> tEnv.executeSql(unSupportedDml5))
.rootCause()
.isInstanceOf(CatalogException.class)
.hasMessage("The option 'auto-increment.fields' is not
supported to alter yet.");
diff --git
a/fluss-server/src/main/java/org/apache/fluss/server/utils/TableDescriptorValidation.java
b/fluss-server/src/main/java/org/apache/fluss/server/utils/TableDescriptorValidation.java
index d3bd94cd7..14e4330d7 100644
---
a/fluss-server/src/main/java/org/apache/fluss/server/utils/TableDescriptorValidation.java
+++
b/fluss-server/src/main/java/org/apache/fluss/server/utils/TableDescriptorValidation.java
@@ -123,22 +123,35 @@ public class TableDescriptorValidation {
public static void validateAlterTableProperties(
TableInfo currentTable, Set<String> tableKeysToChange) {
TableConfig currentConfig = currentTable.getTableConfig();
- tableKeysToChange.forEach(
- k -> {
- if (isTableStorageConfig(k) && !isAlterableTableOption(k))
{
- throw new InvalidAlterTableException(
- "The option '" + k + "' is not supported to
alter yet.");
- }
- if (!currentConfig.getDataLakeFormat().isPresent()
- &&
ConfigOptions.TABLE_DATALAKE_ENABLED.key().equals(k)) {
- throw new InvalidAlterTableException(
- String.format(
- "The option '%s' cannot be altered for
tables that were"
- + " created before the Fluss
cluster enabled datalake.",
-
ConfigOptions.TABLE_DATALAKE_ENABLED.key()));
- }
- });
+ List<String> unsupportedKeys =
+ tableKeysToChange.stream()
+ .filter(k -> isTableStorageConfig(k) &&
!isAlterableTableOption(k))
+ .collect(Collectors.toList());
+ if (!unsupportedKeys.isEmpty()) {
+ throw new InvalidAlterTableException(
+ String.format(
+ "The following options are not supported to alter
yet: %s.",
+ unsupportedKeys.stream()
+ .map(k -> "'" + k + "'")
+ .collect(Collectors.joining(", "))));
+ }
+
+ if (!currentConfig.getDataLakeFormat().isPresent()) {
+ List<String> datalakeKeys =
+ tableKeysToChange.stream()
+ .filter(k -> k.startsWith("table.datalake."))
+ .collect(Collectors.toList());
+ if (!datalakeKeys.isEmpty()) {
+ throw new InvalidAlterTableException(
+ String.format(
+ "The following options cannot be altered for
tables that were"
+ + " created before the Fluss cluster
enabled datalake: %s.",
+ datalakeKeys.stream()
+ .map(k -> "'" + k + "'")
+ .collect(Collectors.joining(", "))));
+ }
+ }
}
private static void checkSystemColumns(RowType schema) {