cloud-fan commented on a change in pull request #26182: [SPARK-29523][SQL] SHOW
COLUMNS should do multi-catalog resolution.
URL: https://github.com/apache/spark/pull/26182#discussion_r339064922
##########
File path:
sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
##########
@@ -196,8 +196,10 @@ statement
LIKE pattern=STRING partitionSpec?
#showTable
| SHOW TBLPROPERTIES table=tableIdentifier
('(' key=tablePropertyKey ')')?
#showTblProperties
- | SHOW COLUMNS (FROM | IN) tableIdentifier
- ((FROM | IN) db=errorCapturingIdentifier)?
#showColumns
+ | SHOW COLUMNS (FROM | IN)
+ ((tableName=errorCapturingIdentifier
+ (FROM | IN) namespace=multipartIdentifier) |
+ table=multipartIdentifier)
#showColumns
Review comment:
So this works, but makes the syntax rule a little bit complicated. Another
approach is
```
SHOW COLUMNS (FROM | IN) tableName= multipartIdentifier
((FROM | IN) namespace=multipartIdentifier)?
```
In `visitShowColumns`, if `namespace` is specified, we check the length of
`tableName`, and throw exception if it has more than one part.
By doing this, we also have a chance to give better error message, telling
users that they can only use single-part table name if `FROM namespace` is
specified.
----------------------------------------------------------------
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]