dtenedor opened a new pull request, #56477:
URL: https://github.com/apache/spark/pull/56477

   ## What changes were proposed in this pull request?
   
   This PR refactors the COALESCE / REPARTITION / REPARTITION_BY_RANGE / 
REBALANCE
   hint-building helpers out of the `ResolveHints.ResolveCoalesceHints` rule 
and into a
   reusable `CoalesceHintUtils` object, so the logic can be shared without 
depending on
   fixed-point rule state.
   
   - Added `org.apache.spark.sql.catalyst.analysis.CoalesceHintUtils`, 
containing the pure,
     stateless hint-building helpers lifted out of `ResolveCoalesceHints`:
     - `getNumOfPartitions`
     - `validateParameters`
     - `createRepartition`
     - `createRepartitionByRange`
     - `transformStringToAttribute`
   - These helpers contain no tree-traversal logic and depend only on OSS 
classes
     (`UnresolvedHint`, `Repartition`, `RepartitionByExpression`, the literal 
extractors, and
     `QueryCompilationErrors`), so they are safe to call outside the rule.
   - `ResolveCoalesceHints` now imports `CoalesceHintUtils._` and delegates to 
it. The
     `createRebalance` helper stays in the rule (it builds 
`RebalancePartitions` inline) and
     delegates to the shared `getNumOfPartitions` and `validateParameters`. The 
rule retains
     its only state dependency, `conf.adaptiveExecutionEnabled`, used to gate 
`REBALANCE`.
   - Trimmed the now-unused expression imports in `ResolveHints.scala` down to 
`StringLiteral`.
   
   No behavior change: the extracted helpers are behavior-identical to the 
originals
   (`getNumOfPartitions` still re-reads `hint.parameters.tail`, and the nested
   `createRepartitionByExpression` closures are preserved as-is).
   
   ## How was this patch tested?
   
   Existing hint-resolution test coverage (e.g. join/coalesce hint suites) pins 
the behavior;
   this is a pure extraction with no functional change.
   
   ## Was this patch authored or co-authored using generative AI tooling?
   
   No


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