dtenedor commented on code in PR #60588:
URL: https://github.com/apache/spark/pull/60588#discussion_r4619068728


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -7048,13 +7044,10 @@ class AstBuilder extends DataTypeAstBuilder
     val columnNameParts = typedVisit[Seq[String]](ctx.colName)
     if (!conf.resolver(columnNameParts.last,
         getIdentifierText(ctx.colType().colName))) {
-      throw 
QueryParsingErrors.operationInHiveStyleCommandUnsupportedError("Renaming 
column",
-        "ALTER COLUMN", ctx, Some("please run RENAME COLUMN instead"))
+      throw QueryParsingErrors.changeColumnRenameUnsupportedError(ctx)
     }
     if (ctx.colType.NULL != null) {
-      throw QueryParsingErrors.operationInHiveStyleCommandUnsupportedError(
-        "NOT NULL", "ALTER COLUMN", ctx,
-        Some("please run ALTER COLUMN ... SET/DROP NOT NULL instead"))
+      throw QueryParsingErrors.changeColumnNotNullUnsupportedError(ctx)

Review Comment:
   Added in 6788da3010d. 'alter table: hive style change column' in catalyst 
`DDLParserSuite` now checks `ALTER TABLE table_name CHANGE COLUMN a.b.c c INT 
NOT NULL` for `UNSUPPORTED_CHANGE_COLUMN.NOT_NULL`, SQLSTATE 0A000, empty 
parameters and the whole statement as the context. The column keeps its name, 
so the RENAME check does not fire first.
   



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -2873,7 +2873,7 @@ class AstBuilder extends DataTypeAstBuilder
         }
         val bytesStr = ctx.bytes.getText
         if (bytesStr.matches("[0-9]+[bBkKmMgG]")) {
-          throw 
QueryParsingErrors.tableSampleByBytesUnsupportedError("byteLengthLiteral", ctx)
+          throw QueryParsingErrors.tableSampleByBytesUnsupportedError("BYTES", 
ctx)
         } else {
           throw QueryParsingErrors.invalidByteLengthLiteralError(bytesStr, ctx)

Review Comment:
   Good catch, thanks. Applied in 6788da3010d: the error now gets 
`source(ctx.bytes)`, and your test is in 'sampled relations' in 
`PlanParserSuite`. As you said, `pipe-operators.sql` is unchanged.
   



##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/DDLParserSuite.scala:
##########
@@ -1496,11 +1496,9 @@ class DDLParserSuite extends AnalysisTest {
     val sql4 = "ALTER TABLE table_name CHANGE COLUMN a.b.c new_name INT"
     checkError(
       exception = parseException(sql4),
-      condition = "_LEGACY_ERROR_TEMP_0034",
-      parameters = Map(
-        "operation" -> "Renaming column",
-        "command" -> "ALTER COLUMN",
-        "msg" -> ", please run RENAME COLUMN instead"),
+      condition = "UNSUPPORTED_CHANGE_COLUMN.RENAME",

Review Comment:
   Added your test in 6788da3010d, thanks.
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to