[spark] Support partition statistics in SHOW TABLE EXTENDED PARTITION command#7612
Merged
YannByron merged 3 commits intoapache:masterfrom Apr 10, 2026
Merged
Conversation
739ceae to
9c62ca7
Compare
There was a problem hiding this comment.
Pull request overview
Adds partition-level statistics to Spark’s SHOW TABLE EXTENDED ... PARTITION(...) output for Paimon tables by wiring SupportsPartitionManagement.loadPartitionMetadata to real partition stats and surfacing them in the Spark 3 command implementation.
Changes:
- Implement
loadPartitionMetadatainPaimonPartitionManagementto return partition stats (record count, file size, file count, last file creation time) from snapshot partition entries. - Update Spark 3
PaimonShowTablePartitionCommandto display “Partition Parameters” and a human-readable “Partition Statistics” line. - Extend unit tests to assert that partition parameters (and recordCount values) appear in
SHOW TABLE EXTENDED ... PARTITION(...)output.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| paimon-spark/paimon-spark3-common/src/main/scala/org/apache/paimon/spark/commands/PaimonShowTablePartitionCommand.scala | Formats and prints partition metadata and derived partition statistics in SHOW TABLE EXTENDED (Spark 3 path). |
| paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/PaimonPartitionManagement.scala | Implements loadPartitionMetadata by reading partition entries from the snapshot reader and returning stats as metadata. |
| paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/DescribeTableTestBase.scala | Adds assertions that SHOW TABLE EXTENDED PARTITION output includes partition parameter keys and expected recordCount values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...common/src/main/scala/org/apache/paimon/spark/commands/PaimonShowTablePartitionCommand.scala
Show resolved
Hide resolved
9c62ca7 to
e9792f3
Compare
e9792f3 to
25fade7
Compare
YannByron
reviewed
Apr 9, 2026
...spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/DescribeTableTestBase.scala
Outdated
Show resolved
Hide resolved
Contributor
|
+1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Examples
Before
Only partition values were displayed. The TODO
"Partition Parameters", "Created Time", "Last Access", "Partition Statistics"was left unimplemented, andloadPartitionMetadataalways returned an empty map.After
Partition Values: [dt=2025-01-01]
Partition Parameters: {recordCount=2, fileSizeInBytes=741, fileCount=1, lastFileCreationTime=1744105200000}
Partition Statistics: 2 rows, 741 bytes
Tests
CI