cloud-fan commented on a change in pull request #27444: [SPARK-30614][SQL] The
native ALTER COLUMN syntax should change one property at a time
URL: https://github.com/apache/spark/pull/27444#discussion_r374479332
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/command/PlanResolutionSuite.scala
##########
@@ -1012,27 +1012,28 @@ class PlanResolutionSuite extends AnalysisTest {
Seq("v1Table" -> true, "v2Table" -> false, "testcat.tab" -> false).foreach
{
case (tblName, useV1Command) =>
val sql1 = s"ALTER TABLE $tblName ALTER COLUMN i TYPE bigint"
- val sql2 = s"ALTER TABLE $tblName ALTER COLUMN i TYPE bigint COMMENT
'new comment'"
- val sql3 = s"ALTER TABLE $tblName ALTER COLUMN i COMMENT 'new comment'"
+ val sql2 = s"ALTER TABLE $tblName ALTER COLUMN i COMMENT 'new comment'"
val parsed1 = parseAndResolve(sql1)
val parsed2 = parseAndResolve(sql2)
val tableIdent = TableIdentifier(tblName, None)
if (useV1Command) {
+ val oldColumn = StructField("i", IntegerType)
val newColumn = StructField("i", LongType)
val expected1 = AlterTableChangeColumnCommand(
tableIdent, "i", newColumn)
val expected2 = AlterTableChangeColumnCommand(
- tableIdent, "i", newColumn.withComment("new comment"))
+ tableIdent, "i", oldColumn.withComment("new comment"))
comparePlans(parsed1, expected1)
comparePlans(parsed2, expected2)
- val e1 = intercept[AnalysisException] {
+ val sql3 = s"ALTER TABLE $tblName ALTER COLUMN j COMMENT 'new
comment'"
+ val e1 = intercept[IllegalArgumentException] {
parseAndResolve(sql3)
}
- assert(e1.getMessage.contains("ALTER COLUMN with v1 tables must
specify new data type"))
+ assert(e1.getMessage.contains("j does not exist. Available: i, s"))
Review comment:
shall we test it for v2 table as well?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]