Skip to content

Commit

Permalink
[SPARK-22999][SQL] show databases like command' can remove the like k…
Browse files Browse the repository at this point in the history
…eyword

## What changes were proposed in this pull request?

SHOW DATABASES (LIKE pattern = STRING)? Can be like the back increase?
When using this command, LIKE keyword can be removed.
You can refer to the SHOW TABLES command, SHOW TABLES 'test *' and SHOW TABELS like 'test *' can be used.
Similarly SHOW DATABASES 'test *' and SHOW DATABASES like 'test *' can be used.

## How was this patch tested?
unit tests   manual tests
Please review http://spark.apache.org/contributing.html before opening a pull request.

Author: guoxiaolong <[email protected]>

Closes #20194 from guoxiaolongzte/SPARK-22999.

(cherry picked from commit 42a1a15)
Signed-off-by: gatorsmile <[email protected]>
  • Loading branch information
guoxiaolong authored and gatorsmile committed Jan 14, 2018
1 parent 9051e1a commit 2879236
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ statement
(LIKE? pattern=STRING)? #showTables
| SHOW TABLE EXTENDED ((FROM | IN) db=identifier)?
LIKE pattern=STRING partitionSpec? #showTable
| SHOW DATABASES (LIKE pattern=STRING)? #showDatabases
| SHOW DATABASES (LIKE? pattern=STRING)? #showDatabases
| SHOW TBLPROPERTIES table=tableIdentifier
('(' key=tablePropertyKey ')')? #showTblProperties
| SHOW COLUMNS (FROM | IN) tableIdentifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,10 @@ abstract class DDLSuite extends QueryTest with SQLTestUtils {
sql("SHOW DATABASES LIKE '*db1A'"),
Row("showdb1a") :: Nil)

checkAnswer(
sql("SHOW DATABASES '*db1A'"),
Row("showdb1a") :: Nil)

checkAnswer(
sql("SHOW DATABASES LIKE 'showdb1A'"),
Row("showdb1a") :: Nil)
Expand Down

0 comments on commit 2879236

Please sign in to comment.