Skip to content
Prev Previous commit
Next Next commit
fix
  • Loading branch information
panbingkun committed Jul 3, 2024
commit fe674fe9cb97d08a81846982350ebacf9fc168d0
6 changes: 0 additions & 6 deletions common/utils/src/main/resources/error/error-conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4252,12 +4252,6 @@
],
"sqlState" : "42883"
},
"UNSET_NONEXISTENT_PROPERTIES" : {
"message" : [
"Attempted to unset non-existent properties [<properties>] in table <table>."
],
"sqlState" : "42K0J"
},
"UNSUPPORTED_ADD_FILE" : {
"message" : [
"Don't support add file."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2658,16 +2658,6 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase with Compilat
"config" -> SQLConf.ALLOW_NON_EMPTY_LOCATION_IN_CTAS.key))
}

def unsetNonExistentPropertiesError(
properties: Seq[String], table: TableIdentifier): Throwable = {
new AnalysisException(
errorClass = "UNSET_NONEXISTENT_PROPERTIES",
messageParameters = Map(
"properties" -> properties.map(toSQLId).mkString(", "),
"table" -> toSQLId(table.nameParts))
)
}

def alterTableChangeColumnNotSupportedForColumnTypeError(
tableName: String,
originColumn: StructField,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,23 +327,6 @@ abstract class DDLSuite extends QueryTest with DDLSuiteBase {

protected val reversedProperties = Seq(PROP_OWNER)

test("ALTER TABLE UNSET nonexistent property should throw an exception") {
val tableName = "test_table"
withTable(tableName) {
sql(s"CREATE TABLE $tableName (a STRING, b INT) USING parquet")

checkError(
exception = intercept[AnalysisException] {
sql(s"ALTER TABLE $tableName UNSET TBLPROPERTIES ('test_prop1', 'test_prop2', 'comment')")
},
errorClass = "UNSET_NONEXISTENT_PROPERTIES",
parameters = Map(
"properties" -> "`test_prop1`, `test_prop2`",
"table" -> "`spark_catalog`.`default`.`test_table`")
)
}
}

test("alter table: change column (datasource table)") {
testChangeColumn(isDatasourceTable = true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -763,15 +763,9 @@ class HiveDDLSuite
sql(s"ALTER VIEW $viewName UNSET TBLPROPERTIES ('p')")
checkProperties(Map())

checkError(
exception = intercept[AnalysisException] {
sql(s"ALTER VIEW $viewName UNSET TBLPROPERTIES ('p')")
},
errorClass = "UNSET_NONEXISTENT_PROPERTIES",
parameters = Map(
"properties" -> "`p`",
"table" -> s"`$SESSION_CATALOG_NAME`.`default`.`view1`")
)
// unset non-existent properties
sql(s"ALTER VIEW $viewName UNSET TBLPROPERTIES ('p')")
checkProperties(Map())
}
}
}
Expand Down Expand Up @@ -1880,16 +1874,6 @@ class HiveDDLSuite
"tableName" -> "spark_catalog.default.tbl",
"invalidKeys" -> s"[${forbiddenPrefix}foo]")
)
checkError(
exception = intercept[AnalysisException] {
sql(s"ALTER TABLE tbl UNSET TBLPROPERTIES ('${forbiddenPrefix}foo')")
},
errorClass = "UNSET_NONEXISTENT_PROPERTIES",
parameters = Map(
"properties" -> (s"${(forbiddenPrefix.split("\\.") :+ "foo").
map(part => s"`$part`").mkString(".")}"),
"table" -> "`spark_catalog`.`default`.`tbl`")
)
checkError(
exception = intercept[AnalysisException] {
sql(s"CREATE TABLE tbl2 (a INT) TBLPROPERTIES ('${forbiddenPrefix}foo'='anything')")
Expand Down