AngersZhuuuu opened a new pull request #31505:
URL: https://github.com/apache/spark/pull/31505
### What changes were proposed in this pull request?
Add `SHOW PARTITIONS` as table-valued function 'show_partitions'
In origin, we can't directly analysis partition metadata information in
SQL, we need export it out and then analysis on it.
Now, we can just use SQL to do this.
Analysis such as which partition is lost? how many partitions in a
partition value range etc
### Why are the changes needed?
Make it convenient for user to analysis metadata
### Does this PR introduce _any_ user-facing change?
User can use `show_partitions` table-valued function such as .
```
sql("CREATE TABLE t(id INT) PARTITIONED BY (part STRING)")
sql("INSERT OVERWRITE TABLE t PARTITION (part = '1') SELECT 1")
sql("INSERT OVERWRITE TABLE t PARTITION (part = '2') SELECT 2")
sql("SELECT * FROM show_partitions('t')").show()
+---------+
|partition|
+---------+
| part=1|
| part=2|
+---------+
```
### How was this patch tested?
added UT
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]