-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-28810][DOC][SQL] Document SHOW TABLES in SQL Reference. #25561
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
form -> from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
databse -> database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refer tables.scala for syntax
6780347 to
172849a
Compare
|
@dilipbiswal @gatorsmile Please review and kindly check for merging. |
|
ok to test |
|
Test build #111092 has finished for PR 25561 at commit
|
| </dd> | ||
| <dt><code><em>LIKE 'regex_pattern'</em></code></dt> | ||
| <dd> | ||
| A regex pattern that is used to filter out unwanted functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shivusondur Can you please check the code here ? Looks like this is copied from SHOW FUNCTIONS. Please make sure the pattern is processed the same way in SHOW TABLES. If so, you can change from "unwanted functions" to "unwanted tables"..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled
| {% highlight sql %} | ||
| -- List all tables in default database | ||
| SHOW TABLES; | ||
| +-----------+------------+--------------+--+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: two space align for results to match the other prs ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled
|
|
||
| {% endhighlight %} | ||
|
|
||
| ### Related statements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove period
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| SHOW TABLES [{FROM|IN} database_name] [LIKE 'regex_pattern'] | ||
| {% endhighlight %} | ||
|
|
||
| ### Parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Parameters ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
2. Changed to "unwanted tables" 3. Added the "two space align in the result" 4. removed the period in "statements" 5. verified the links in the Related statements
172849a to
19f39fc
Compare
|
@dilipbiswal |
|
Test build #111117 has finished for PR 25561 at commit
|
| <dt><code><em>LIKE 'regex_pattern'</em></code></dt> | ||
| <dd> | ||
| Specifies the regex pattern that is used to filter out unwanted tables. | ||
| <br> - Only `*` and `|` are allowed as wildcard pattern. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shivusondur Can you please include the example with output using the 'I' as wildcard ? From the code its not clear to me if this is supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dilipbiswal
Done
| {% highlight sql %} | ||
| -- List all tables in default database | ||
| SHOW TABLES; | ||
| +-----------+------------+--------------+--+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please lets fix the formatting. Did we construct this output by hand ? Can we paste the
actual output here please so we preserve the formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dilipbiswal
I just Copy and paste the actual output from the Beeline console
Here is the beeline console snap

In the UI it looks like below, i think it is normal

Only in the git file editor, it shows inconsistent.
|
Test build #111140 has finished for PR 25561 at commit
|
| | default | sam | false | | ||
| | default | sam1 | false | | ||
| +-----------+------------+--------------+--+ | ||
| -- List all tables matching the pattern `sam*|suj` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: can we have a line between previous test and this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dilipbiswal
Done, updated the snap's also.
|
Test build #111148 has finished for PR 25561 at commit
|
| ### Description | ||
|
|
||
| **This page is under construction** | ||
| List all the `tables` from the database with `database-name` and `is temporary table`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shivusondur Sorry.. re-reading this one last time :-)
SHOW TABLES statement returns all the tables for an optionally specified database. Additionally, the output
of this statement may be filtered via an optional matching pattern. If no database is specified then the tables
are returned from the current database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DOne
|
LGTM - except a minor comment. |
|
cc @gatorsmile |
|
@dilipbiswal and @gatorsmile |
|
Test build #111176 has finished for PR 25561 at commit
|
| <dt><code><em>LIKE 'regex_pattern'</em></code></dt> | ||
| <dd> | ||
| Specifies the regex pattern that is used to filter out unwanted tables. | ||
| <br> - Only `*` and `|` are allowed as wildcard pattern. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| isn't a wildcard pattern, so I wouldn't imply it is.
Is it really treated as a full regex otherwise? if not, I wouldn't call it a regex unless it is generally called this in other similar references.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srowen Thats a very good point Sean. How about we name the pattern 'identifier_with_wildcards' (and describe as such) as mentioned in ShowTablesCommand's comment ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a SQL-like pattern that supports wildcards like %? then I'd just call it a pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srowen I quickly tried in my env. It does not support SQL-like pattern like %. I only saw the following work :
*: Matches 0 or more characters..: Matches a char|: works like or expression.
@shivusondur Can you please confirm ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dilipbiswal @srowen
I also tesed, it is same behaviour you mentioned above.
It will use the below method to handle, here they are handling "|" and "*" seperatly, remaining treating as regex
spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala
Line 88 in e1ea806
| def filterPattern(names: Seq[String], pattern: String): Seq[String] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, your comment is consistent with the docs then. Hm, but isn't it more accurate to say that * and | don't work like in regexes? * matches 0 or more characters, and | delimits whole regexes, which is different, but the rest is the same. Maybe a comment more like that. "The pattern is a regex except that * matches 0 or more characters by itself, and | may only be used at the top level to delimit alternative regexes to match." ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srowen @dilipbiswal
Thank you both for your time in reviewing.
I updated according to your suggestion and screenshot also I updated.
Now it will look like below.

|
Test build #111655 has finished for PR 25561 at commit
|
| ### Description | ||
|
|
||
| **This page is under construction** | ||
| `SHOW TABLES` statement returns all the tables for an optionally specified `database`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: add "The" at the start.
via -> by
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
Test build #111750 has finished for PR 25561 at commit
|
| <dt><code><em>LIKE 'regex_pattern'</em></code></dt> | ||
| <dd> | ||
| Specifies the regex pattern that is used to filter out unwanted tables. | ||
| <br> - The pattern is a regex except that `*` and `|`characters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"... except that * and | work differently"
| ### Description | ||
|
|
||
| **This page is under construction** | ||
| The `SHOW TABLES` statement returns all the tables for an optionally specified `database`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: no need to back-tick database here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srowen
Done
| <dt><code><em>LIKE 'regex_pattern'</em></code></dt> | ||
| <dd> | ||
| Specifies the regex pattern that is used to filter out unwanted tables. | ||
| <br> - The pattern is a regex except that `*` and `|`characters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shivusondur drop the "that" ?
@srowen Can you help check the above sentence please ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dilipbiswal
done
|
Test build #111830 has finished for PR 25561 at commit
|
|
LGTM |
| <dt><code><em>LIKE 'regex_pattern'</em></code></dt> | ||
| <dd> | ||
| Specifies the regex pattern that is used to filter out unwanted tables. | ||
| <br> - The pattern is a regex except `*` and `|`characters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: can you use an HTML unordered list? <ul><li>... etc? Or just make this a paragraph, not bullet points.
I still think this is kind of unclear, per the last comment. "except * ..." should be clarified. "except that * and | have a different meaning."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
used the html ul and li tags
and added the description like below
Except *and| characters remaining characters will follow the regular expression convention.
| <br> - The leading and trailing blanks are trimmed in the input pattern before processing. | ||
| Specifies the regular expression pattern that is used to filter out unwanted tables. | ||
| <ul> | ||
| <li> Except `*` and `|` characters remaining characters will follow the regular expression convention.</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Except for * and |, the pattern works like a regex"
| Specifies the regular expression pattern that is used to filter out unwanted tables. | ||
| <ul> | ||
| <li> Except `*` and `|` characters remaining characters will follow the regular expression convention.</li> | ||
| <li> `*` matches 0 or more characters and `|` used to provide more than one regex with OR condition. </li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"* alone matches 0 or more characters, and | is used to separate multiple different regexes, any of which can match"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments handled
Thanks for reviewing
| <dd> | ||
| Specifies the regular expression pattern that is used to filter out unwanted tables. | ||
| <ul> | ||
| <li> Except for * and | character, the pattern works like a regex.</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I might put back the back-ticks or quotes around special chars here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. The same correction I also interested. thank you
|
Merged to master |
What changes were proposed in this pull request?
Added the reference for SHOW TABLES sql command.
Why are the changes needed?
To help the customer usage
Does this PR introduce any user-facing change?
It updates the Sql command reference doc.
How was this patch tested?
Attached the Snap