uros-b opened a new pull request, #58758:
URL: https://github.com/apache/spark/pull/58758

   ### What changes were proposed in this pull request?
   
   `PairRDDFunctions` repeats the same guard -- throw 
`hashPartitionerCannotPartitionArrayKeyError()` when the partitioner is a 
`HashPartitioner` and the key type is an array -- in four places: `partitionBy` 
and the three `cogroup` overloads. This extracts it into a single private 
helper, `failOnHashPartitionerWithArrayKey(partitioner)`, and calls it from 
those four sites.
   
   Notes:
   - The `partitionBy` site wrote the condition in the opposite operand order 
(`keyClass.isArray && partitioner.isInstanceOf[HashPartitioner]`). Both 
operands are side-effect-free, so the helper's order is equivalent.
   - The nested check in `combineByKeyWithClassTag` -- inside a broader 
`keyClass.isArray` block that also guards map-side combining -- is 
intentionally left as-is, since it is a different shape.
   
   ### Why are the changes needed?
   
   The guard was duplicated verbatim; consolidating it removes the repetition 
and keeps the array-key / `HashPartitioner` rule in one place. Behavior is 
unchanged.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Existing tests; `build/sbt core/compile` passes. This is a 
behavior-preserving refactor.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8)
   


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