[api][spark] Treat an unreported partition statistic as unknown, not as zero - #9379
Merged
JingsongLi merged 2 commits intoAug 25, 2026
Merged
Conversation
sundapeng
force-pushed
the
fix/rest-partition-absent-statistics
branch
from
August 24, 2026 15:52
f7babbe to
7824d56
Compare
sundapeng
force-pushed
the
fix/rest-partition-absent-statistics
branch
from
August 24, 2026 16:41
d2701ca to
cf0efa0
Compare
A listPartitions response may omit the statistics, since the REST contract does not mark them required. The primitive JsonCreator parameters decoded that absence to 0, which PartitionStatistics.isKnown reads as an exact measurement. Since apache#9351 the zero reaches Spark as a 0 row and 0 byte scan, and a large format table can then be picked as a broadcast build side.
A catalog that cannot tell "never measured" from "measured, and empty" reports a well formed zero. Since apache#9351 that becomes the scan row count, and sizeInBytes follows it down because the row estimate branch is taken whenever numRows is present, leaving the file size fallback unreachable. The scan then enters the optimizer at 0 bytes and can be picked as a broadcast build side.
sundapeng
force-pushed
the
fix/rest-partition-absent-statistics
branch
from
August 24, 2026 16:42
cf0efa0 to
cac4e99
Compare
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
An unreported partition statistic can reach the Spark planner as an exact zero, and a scan over real files then looks free to read.
paimon-api. The statistics are optional in the REST contract, but
Partitiondeclares them as primitivelongin its@JsonCreator, so Jackson decodes an absent field to0andPartitionStatistics.isKnowncalls it a measurement. A static@JsonCreatorfactory now takes them asLongand maps null toUNKNOWN. The public constructor is unchanged, so this is source and binary compatible.totalBucketsandPartitionStatisticsstay as they are; the latter travels the other way as a commit delta, where a negative value is a decrement rather than an unmeasured field.paimon-spark. A catalog that cannot tell "never measured" from "measured, and empty" reports a well formed
0. Since #9351 that becomes the scan row count, andsizeInBytesfollows it to zero because the row estimate branch runs whenevernumRowsis present, leaving the file size fallback unreachable.canBroadcastBySizethen passes at any threshold. A reported zero over real bytes is now left unknown and the size is weighed from the files. Only that case changes: zero rows over zero bytes is still an empty scan, and split row counts come from Paimon's own manifests where zero means zero.Tests
PartitionTest: absent statistics decode toUNKNOWN, an explicit zero stays exact, a full partition round tripsCatalogManagedPartitionScanTest: partitions parsed from statistics free JSON keep the plan row count emptyCatalogManagedPartitionAnalyzeTest: statistics rewritten to zero while the files stay untouched, then the row count comes back unknown and the size above zero. RevertingPaimonStatistics.scalafails that case and no other.CatalogManagedPartitionAnalyzeTeston Spark 3.5 22 tests