dongjoon-hyun commented on a change in pull request #24749: [SPARK-27890][SQL]
Improve SQL parser error message for identifier with hyphens
URL: https://github.com/apache/spark/pull/24749#discussion_r289658813
##########
File path:
sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
##########
@@ -122,7 +126,7 @@ statement
| ALTER (TABLE | VIEW) tableIdentifier
UNSET TBLPROPERTIES (IF EXISTS)? tablePropertyList
#unsetTableProperties
| ALTER TABLE tableIdentifier partitionSpec?
- CHANGE COLUMN? identifier colType colPosition?
#changeColumn
+ CHANGE COLUMN? errorCapturingIdentifier colType colPosition?
#changeColumn
Review comment:
Also, in this case, the current error handling and the output message is
short and succinct enough. Let's not touch `ALTER TABLE` statements. There is
no complex query in this case, isn't it?
```scala
scala> sql("ALTER TABLE t-c CHANGE COLUMNS a (a int)").show
org.apache.spark.sql.catalyst.parser.ParseException:
no viable alternative at input 'ALTER TABLE t-'(line 1, pos 13)
== SQL ==
ALTER TABLE t-c CHANGE COLUMNS a (a int)
-------------^^^
```
----------------------------------------------------------------
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]