Github user dilipbiswal commented on a diff in the pull request:
https://github.com/apache/spark/pull/11991#discussion_r57646589
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkQl.scala ---
@@ -369,13 +369,33 @@ private[sql] class SparkQl(conf: ParserConf =
SimpleParserConf()) extends Cataly
case Token("TOK_CLEARCACHE", Nil) =>
ClearCacheCommand
+ // SHOW TABLES [(IN|FROM) database_name]
['identifier_with_wildcards']
case Token("TOK_SHOWTABLES", args) =>
- val databaseName = args match {
- case Nil => None
- case Token("TOK_FROM", Token(dbName, Nil) :: Nil) :: Nil =>
Option(dbName)
+ // Parses the following conditions
+ // 1. SHOW TABLES
+ // 2. SHOW TABLES FROM database 'table_pattern'
+ // 3. SHOW TABLES FROM database
--- End diff --
@andrewor14 Hello, we always transform to TOK_FROM for both TOK_IN and
TOK_FROM in the grammer file.
https://github.com/apache/spark/blob/637a78f1d3dff00658324de3887d75c5ccd857be/sql/catalyst/src/main/antlr3/org/apache/spark/sql/catalyst/parser/SparkSqlParser.g#L1473
So now, both form works.
```SQL
show tables from default
show tables in default
```
I will fix up the comments to use 'IN' as opposed to 'FROM'. Did you want
to disallow this syntax in the grammer file ? Would there be a
backward-compatibility issue if we do that ?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]