wangyum opened a new pull request #31567:
URL: https://github.com/apache/spark/pull/31567


   ### What changes were proposed in this pull request?
   
   
   This pr pushdown limit through InnerLike when condition is empty(Origin pr: 
#23104). For example:
   ```sql
   CREATE TABLE t1 using parquet AS SELECT id AS a, id AS b FROM range(2);
   CREATE TABLE t2 using parquet AS SELECT id AS d FROM range(2);
   SELECT * FROM t1 CROSS JOIN t2 ON a = d LIMIT 10
   ```
   Before this pr:
   ```
   == Physical Plan ==
   AdaptiveSparkPlan isFinalPlan=false
   +- CollectLimit 10
      +- BroadcastNestedLoopJoin BuildRight, Cross
         :- FileScan parquet default.t1[a#5L,b#6L] Batched: true, DataFilters: 
[], Format: Parquet, Location: InMemoryFileIndex(1 
paths)[file:/private/var/folders/tg/f5mz46090wg7swzgdc69f8q03965_0/T/warehous...,
 PartitionFilters: [], PushedFilters: [], ReadSchema: struct<a:bigint,b:bigint>
         +- BroadcastExchange IdentityBroadcastMode, [id=#43]
            +- FileScan parquet default.t2[d#7L] Batched: true, DataFilters: 
[], Format: Parquet, Location: InMemoryFileIndex(1 
paths)[file:/private/var/folders/tg/f5mz46090wg7swzgdc69f8q03965_0/T/warehous...,
 PartitionFilters: [], PushedFilters: [], ReadSchema: struct<d:bigint>
   ```
   After this pr:
   ```
   == Physical Plan ==
   AdaptiveSparkPlan isFinalPlan=false
   +- CollectLimit 10
      +- BroadcastNestedLoopJoin BuildRight, Cross
         :- LocalLimit 10
         :  +- FileScan parquet default.t1[a#5L,b#6L] Batched: true, 
DataFilters: [], Format: Parquet, Location: InMemoryFileIndex(1 
paths)[file:/private/var/folders/tg/f5mz46090wg7swzgdc69f8q03965_0/T/warehous...,
 PartitionFilters: [], PushedFilters: [], ReadSchema: struct<a:bigint,b:bigint>
         +- BroadcastExchange IdentityBroadcastMode, [id=#51]
            +- LocalLimit 10
               +- FileScan parquet default.t2[d#7L] Batched: true, DataFilters: 
[], Format: Parquet, Location: InMemoryFileIndex(1 
paths)[file:/private/var/folders/tg/f5mz46090wg7swzgdc69f8q03965_0/T/warehous...,
 PartitionFilters: [], PushedFilters: [], ReadSchema: struct<d:bigint>
   ```
   
   ### Why are the changes needed?
   
   Improve query performance.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Unit test.
   


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

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