You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewIllegalArgumentException(String.format("cannot update a missing column: %s", name));
159
+
thrownewSchemaCompatibilityException(String.format("Cannot rename column '%s' because it does not exist in the schema", name));
158
160
}
159
161
if (newName == null || newName.isEmpty()) {
160
-
thrownewIllegalArgumentException(String.format("cannot rename column: %s to empty", name));
162
+
thrownewSchemaCompatibilityException(String.format("Cannot rename column '%s' to empty or null name. New name must be non-empty", name));
161
163
}
162
164
if (internalSchema.hasColumn(newName, caseSensitive)) {
163
-
thrownewIllegalArgumentException(String.format("cannot rename column: %s to a existing name", name));
165
+
thrownewSchemaCompatibilityException(String.format("Cannot rename column '%s' to '%s' because a column with name '%s' already exists in the schema", name, newName, newName));
thrownewHoodieSchemaException(String.format("cannot add column: %s which parent: %s is not exist", name, parent));
341
+
thrownewHoodieSchemaException(String.format("Cannot add column '%s' because its parent column '%s' does not exist in the schema", name, parent));
339
342
}
340
-
TypeparentType = parentField.type();
341
343
if (!(parentField.type() instanceofTypes.RecordType)) {
342
-
thrownewHoodieSchemaException("only support add nested columns to struct column");
344
+
thrownewHoodieSchemaException(String.format(
345
+
"Cannot add nested column '%s' to parent '%s' of type '%s'. Nested columns can only be added to struct/record types", name, parent, parentField.type()));
thrownewHoodieSchemaException(String.format("Cannot add column '%s' multiple times. Column at path '%s' has already been added in this change set", name, fullName));
Copy file name to clipboardExpand all lines: hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/ddl/TestSpark3DDL.scala
+4-5Lines changed: 4 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -363,11 +363,10 @@ class TestSpark3DDL extends HoodieSparkSqlTestBase {
363
363
}
364
364
// check duplicate add or rename
365
365
// keep consistent with hive, column names insensitive
366
-
checkExceptions(s"alter table $tableName rename column col0 to col9")(Seq("cannot rename column: col0 to a existing name",
367
-
"Cannot rename column, because col9 already exists in root"))
368
-
checkExceptions(s"alter table $tableName rename column col0 to COL9")(Seq("cannot rename column: col0 to a existing name", "Cannot rename column, because COL9 already exists in root"))
369
-
checkExceptions(s"alter table $tableName add columns(col9 int first)")(Seq("cannot add column: col9 which already exist", "Cannot add column, because col9 already exists in root"))
370
-
checkExceptions(s"alter table $tableName add columns(COL9 int first)")(Seq("cannot add column: COL9 which already exist", "Cannot add column, because COL9 already exists in root"))
366
+
checkExceptions(s"alter table $tableName rename column col0 to col9")(Seq("Cannot rename column 'col0' to 'col9' because a column with name 'col9' already exists in the schema"))
367
+
checkExceptions(s"alter table $tableName rename column col0 to COL9")(Seq("Cannot rename column 'col0' to 'COL9' because a column with name 'COL9' already exists in the schema"))
368
+
checkExceptions(s"alter table $tableName add columns(col9 int first)")(Seq("Cannot add column 'col9' because it already exists in the schema"))
369
+
checkExceptions(s"alter table $tableName add columns(COL9 int first)")(Seq("Cannot add column 'COL9' because it already exists in the schema"))
371
370
// test add comment for columns / alter columns comment
372
371
spark.sql(s"alter table $tableName add columns(col1_new int comment 'add new columns col1_new after id' after id)")
373
372
spark.sql(s"alter table $tableName alter column col9 comment 'col9 desc'")
0 commit comments