You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "rdtr (via GitHub)" <gi...@apache.org> on 2026/05/26 02:35:25 UTC

[PR] [SPARK-57064][SQL] Widen bucketing rule pattern matches to use FileSourceScanLike trait [spark]

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

    Description:
   
     ## Summary
     - Widen 3 read-only pattern match sites in `DisableUnnecessaryBucketedScan` and `CoalesceBucketsInJoin` from concrete `FileSourceScanExec` to the `FileSourceScanLike` trait
     - Two match sites that call `.copy()` are intentionally left on `FileSourceScanExec`
     - Enables third-party columnar plugins (Gluten, Comet, RAPIDS) to be recognized by bucketing optimization rules
   
     ## Test plan
     - [ ] Existing bucketing test suites pass (no behavioral change for vanilla Spark since `FileSourceScanExec` already extends `FileSourceScanLike`)
     - [ ] Verified all accessed fields (`bucketedScan`, `relation`, `optionalNumCoalescedBuckets`) are declared on the `FileSourceScanLike` trait
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-57064][SQL] Widen bucketing rule pattern matches to use FileSourceScanLike trait [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #56105: [SPARK-57064][SQL] Widen bucketing rule pattern matches to use FileSourceScanLike trait
URL: https://github.com/apache/spark/pull/56105


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-57064][SQL] Widen bucketing rule pattern matches to use FileSourceScanLike trait [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #56105:
URL: https://github.com/apache/spark/pull/56105#discussion_r3331949659


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/bucketing/DisableUnnecessaryBucketedScan.scala:
##########
@@ -142,7 +142,7 @@ object DisableUnnecessaryBucketedScan extends Rule[SparkPlan] {
 
   def apply(plan: SparkPlan): SparkPlan = {
     lazy val hasBucketedScan = plan.exists {
-      case scan: FileSourceScanExec => scan.bucketedScan
+      case scan: FileSourceScanLike => scan.bucketedScan

Review Comment:
   This gate widening looks functionally inert. The actual disabler still requires `FileSourceScanExec`:
   
   ```scala
   case scan: FileSourceScanExec =>
     if (scan.bucketedScan) { ... scan.copy(disableBucketedScan = true) ... }
   ```
   
   so no third-party `FileSourceScanLike` scan is ever disabled. The only behavioral difference vs. before is for a plan whose bucketed scans are *all* third-party: the gate now opens and the rule traverses the whole plan only to return it unchanged, whereas it previously short-circuited here. Any plan containing a bucketed `FileSourceScanExec` already passed the old gate. So this widening adds no optimization and a full-plan traversal cost -- consider reverting just this site, or explaining the intended benefit.
   
   More broadly across both rules: recognition is widened but the `.copy()` mutation sites can't be (the trait has no `.copy()`). For `CoalesceBucketsInJoin` the widening does help, but only in a *mixed* plan whose coalescible side is a vanilla `FileSourceScanExec`; columnar plugins typically convert all scans uniformly, in which case the whole change is inert. What concrete scenario is this targeting? If genuine third-party participation is the goal, the mutation sites would need a trait-level mechanism (e.g. `withCoalescedNumBuckets` / `withDisabledBucketedScan` on `FileSourceScanLike`) that this PR doesn't add.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-57064][SQL] Widen bucketing rule pattern matches to use FileSourceScanLike trait [spark]

Posted by "rdtr (via GitHub)" <gi...@apache.org>.
rdtr commented on PR #56105:
URL: https://github.com/apache/spark/pull/56105#issuecomment-4560362882

    @c21 @cloud-fan would you mind taking a look? This is a small refactor of bucketing rules to use the existing FileSourceScanLike trait which enables third-party scan implementations to be recognized without changing vanilla Spark behavior.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-57064][SQL] Widen bucketing rule pattern matches to use FileSourceScanLike trait [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #56105:
URL: https://github.com/apache/spark/pull/56105#issuecomment-5611395997

   We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
   If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org