-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[SQL] add SHOW command #36509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SQL] add SHOW command #36509
Changes from 7 commits
3d43232
ff335dc
50928b8
feb2d81
0e816b0
f71cf7e
7e14d95
64c00a4
653cc40
c97da8e
6fde9c9
bb2baa9
5108f8d
4a867e7
e3b40a0
c032536
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| { | ||
| "comment": "Modify this file in a trivial way to cause this test suite to run ", | ||
| "modification": 1 | ||
| "modification": 2 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| { | ||
| "comment": "Modify this file in a trivial way to cause this test suite to run.", | ||
| "modification": 1 | ||
| "modification": 3 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -264,6 +264,22 @@ SqlDrop SqlDropCatalog(Span s, boolean replace) : | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * SHOW CATALOGS [ LIKE regex_pattern ] | ||
| */ | ||
| SqlCall SqlShowCatalogs(Span s) : | ||
| { | ||
| SqlNode regex = null; | ||
| } | ||
| { | ||
| <SHOW> <CATALOGS> { s.add(this); } | ||
| [ <LIKE> regex = StringLiteral() ] | ||
| { | ||
| return new SqlShowCatalogs(s.end(this), false, regex); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * CREATE DATABASE ( IF NOT EXISTS )? ( catalog_name '.' )? database_name | ||
| */ | ||
|
|
@@ -331,6 +347,39 @@ SqlDrop SqlDropDatabase(Span s, boolean replace) : | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * SHOW DATABASES [ ( FROM | IN )? catalog_name ] [LIKE regex_pattern ] | ||
| */ | ||
| SqlCall SqlShowDatabases(Span s) : | ||
| { | ||
| SqlIdentifier catalogName = null; | ||
| SqlNode regex = null; | ||
| } | ||
| { | ||
| <SHOW> <DATABASES> { s.add(this); } | ||
| [ ( <FROM> | <IN> ) catalogName = SimpleIdentifier() ] | ||
| [ <LIKE> regex = StringLiteral() ] | ||
| { | ||
| return new SqlShowDatabases(s.end(this), false, catalogName, regex); | ||
| } | ||
| } | ||
|
|
||
| SqlCall SqlShowCurrent(Span s) : | ||
| { | ||
| } | ||
| { | ||
| <SHOW> <CURRENT> { s.add(this); } | ||
| ( | ||
| <CATALOG> { | ||
| return new SqlShowCatalogs(s.end(this), true, null); | ||
| } | ||
| | | ||
| <DATABASE> { | ||
| return new SqlShowDatabases(s.end(this), true, null, null); | ||
| } | ||
| ) | ||
| } | ||
|
|
||
|
|
||
| SqlNodeList PartitionFieldList() : | ||
| { | ||
|
|
@@ -456,6 +505,24 @@ SqlDrop SqlDropTable(Span s, boolean replace) : | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * SHOW TABLES [ ( FROM | IN )? [ catalog_name '.' ] database_name ] [ LIKE regex_pattern ] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have it as a general construction yet (catalogs and databases are relatively new concepts in Beam SQL). I could put a comment at the top of the doc, something like Lmk if that's what you had in mind?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well.. we've have tables named like |
||
| */ | ||
| SqlCall SqlShowTables(Span s) : | ||
| { | ||
| SqlIdentifier database = null; | ||
| SqlNode regex = null; | ||
| } | ||
| { | ||
| <SHOW> <TABLES> { s.add(this); } | ||
| [ (<FROM> | <IN>) database = CompoundIdentifier() ] | ||
| [ <LIKE> regex = StringLiteral() ] | ||
| { | ||
| return new SqlShowTables(s.end(this), database, regex); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Schema.FieldType FieldType() : | ||
| { | ||
| final SqlTypeName collectionTypeName; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,7 +53,10 @@ public void execute(CalcitePrepare.Context context) { | |
|
|
||
| BeamCalciteSchema beamCalciteSchema; | ||
| if (schema instanceof CatalogManagerSchema) { | ||
| CatalogSchema catalogSchema = ((CatalogManagerSchema) schema).getCatalogSchema(pathOverride); | ||
| CatalogSchema catalogSchema = | ||
| pathOverride.catalog() != null | ||
|
||
| ? ((CatalogManagerSchema) schema).getCatalogSchema(pathOverride) | ||
| : ((CatalogManagerSchema) schema).getCurrentCatalogSchema(); | ||
| beamCalciteSchema = catalogSchema.getDatabaseSchema(pathOverride); | ||
| } else if (schema instanceof BeamCalciteSchema) { | ||
| beamCalciteSchema = (BeamCalciteSchema) schema; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.