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
@@ -280,11 +280,10 @@ class TestSpark3DDL extends HoodieSparkSqlTestBase {
280
280
}
281
281
// check duplicate add or rename
282
282
// keep consistent with hive, column names insensitive
283
-
checkExceptions(s"alter table $tableName rename column col0 to col9")(Seq("cannot rename column: col0 to a existing name",
284
-
"Cannot rename column, because col9 already exists in root"))
285
-
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"))
286
-
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"))
287
-
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"))
283
+
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"))
284
+
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"))
285
+
checkExceptions(s"alter table $tableName add columns(col9 int first)")(Seq("Cannot add column 'col9' because it already exists in the schema"))
286
+
checkExceptions(s"alter table $tableName add columns(COL9 int first)")(Seq("Cannot add column 'COL9' because it already exists in the schema"))
288
287
// test add comment for columns / alter columns comment
289
288
spark.sql(s"alter table $tableName add columns(col1_new int comment 'add new columns col1_new after id' after id)")
290
289
spark.sql(s"alter table $tableName alter column col9 comment 'col9 desc'")
0 commit comments