ulysses-you opened a new pull request, #60078:
URL: https://github.com/apache/spark/pull/60078

   ### What changes were proposed in this pull request?
   
   - `InternalRowComparableWrapper` now prints the values of the row it wraps. 
Before, a key rendered as an object identity (`...@1a2b3c`), which is what plan 
strings showed. The values are read through the wrapper's types 
(`row.toSeq(dataTypes)`), so rows that have no `toString` of their own 
(`UnsafeRow`, Iceberg's `StructInternalRow`) print correctly too.
   - `KeyedPartitioning.stringArgs` summarizes the partition key list. A keyed 
partitioning can hold one key per split, so the keys take only the slots 
`spark.sql.debug.maxToStringFields` leaves after the expressions, `isGrouped`, 
`isCollapsed` and the two origins; when they do not all fit, the last slot 
reports their total. When no slot is left even for that, the total wins over a 
trailing field.
   - The wrapper requires the row width to match the number of types it is 
compared at, so a connector that reports a `partitionKey()` row of the wrong 
width fails at the point of the mismatch instead of later in a hash or 
comparison.
   
   ### Why are the changes needed?
   
   Keyed partitioning plan strings carried no key values, and with one key per 
split a raw key list floods the plan.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, physical plan strings change. With 
`spark.sql.debug.maxToStringFields=10`:
   
   Before, the keys are object identities:
   `keyedpartitioning(x#0, InternalRowComparableWrapper@1a2b3c4d, 
InternalRowComparableWrapper@5e6f7a8b, ...)`
   
   After:
   `keyedpartitioning(x#0, [1], [2], [3], [4], [5], [6], ... 12 partition keys 
in total, true, false)`
   
   No query result or execution behavior changes.
   
   ### How was this patch tested?
   
   New unit tests:
   - `SPARK-60859: a KeyedPartitioning plan string shows the keys that fit and 
their total` covers the key budget, multiple expressions, both origins, and the 
zero-budget edge.
   - `SPARK-60859: a wrapper prints its row values` covers `GenericInternalRow` 
and `UnsafeRow`.
   - `SPARK-60859: a wrapper rejects a row whose width disagrees with its 
types` pins the new failure message.
   
   ```
   build/sbt 'catalyst/testOnly *InternalRowComparableWrapperSuite 
*DistributionSuite'   # 30 passed
   build/sbt 'sql/testOnly *GroupPartitionsExecSuite *EnsureRequirementsSuite 
*KeyGroupedPartitioningSuite *DataSourceV2CatalystRuntimeFilterSuite 
*DSv2PlanMergingSuite *ProjectedOrderingAndPartitioningSuite 
*ValidateRequirementsSuite *DataFrameSetOperationsSuite'   # 504 passed
   ```
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to