Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LimitPushdown optimization rule and CoalesceBatchesExec fetch #27

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
d868d60
Add LimitPushdown skeleton
alihandroid Jul 10, 2024
36f0ba9
Transform StreamTableExec into fetching version when skip is 0
alihandroid Jul 11, 2024
532fe69
Transform StreamTableExec into fetching version when skip is non-zero
alihandroid Jul 11, 2024
8dcd86b
Fix non-zero skip test
alihandroid Jul 11, 2024
26636f1
Add fetch field to CoalesceBatchesExec
alihandroid Jul 13, 2024
145da2d
Tag ProjectionExec, CoalescePartitionsExec and SortPreservingMergeExe…
alihandroid Jul 13, 2024
1d0d2c8
Add `with_fetch` to SortExec
alihandroid Jul 13, 2024
d4eab68
Push limit down through supporting ExecutionPlans
alihandroid Jul 13, 2024
ff1609f
Reorder LimitPushdown optimization to before SanityCheckPlan
alihandroid Jul 13, 2024
3a8989f
Refactor LimitPushdown tests
alihandroid Jul 15, 2024
10d6436
Refactor LimitPushdown tests
alihandroid Jul 15, 2024
26c907a
Add more LimitPushdown tests
alihandroid Jul 15, 2024
1f3299a
Add fetch support to CoalesceBatchesExec
alihandroid Jul 15, 2024
49efeb7
Fix tests that were affected
alihandroid Jul 15, 2024
68a315c
Refactor LimitPushdown push_down_limits
alihandroid Jul 15, 2024
7960c0a
Remove unnecessary parameter from coalesce_batches_exec
alihandroid Jul 15, 2024
5294cd2
Format files
alihandroid Jul 17, 2024
2bb7385
Apply clippy fixes
alihandroid Jul 17, 2024
54d8713
Make CoalesceBatchesExec display consistent
alihandroid Jul 17, 2024
db48495
Fix slt tests according to LimitPushdown rules
alihandroid Jul 17, 2024
f57326c
Resolve linter errors
mustafasrepo Jul 19, 2024
faaa4b5
Minor changes
mustafasrepo Jul 19, 2024
12a8d44
Merge branch 'apache_main' into alihan_apache_main
mustafasrepo Jul 19, 2024
c9c0845
Minor changes
mustafasrepo Jul 19, 2024
0fb546f
Fix GlobalLimitExec sometimes replacing LocalLimitExec
alihandroid Jul 21, 2024
79b0ba9
Fix unnecessary LocalLimitExec for ProjectionExec
alihandroid Jul 21, 2024
c2984d1
Rename GlobalOrLocal into LimitExec
alihandroid Jul 21, 2024
62c1f10
Clarify pushdown recursion
alihandroid Jul 21, 2024
5509bcf
Minor changes
mustafasrepo Jul 22, 2024
082d25e
Minor
berkaysynnada Jul 22, 2024
8b514fa
Do not display when fetch is None
berkaysynnada Jul 22, 2024
fb625c9
.rs removal
berkaysynnada Jul 22, 2024
bf75757
Clean-up tpch plans
berkaysynnada Jul 22, 2024
cb9806f
Clean-up comments
berkaysynnada Jul 22, 2024
887e75c
Update datafusion/core/src/physical_optimizer/optimizer.rs
ozankabak Jul 22, 2024
24282aa
Update datafusion/physical-plan/src/coalesce_batches.rs
ozankabak Jul 22, 2024
eb1b4c8
Update datafusion/physical-plan/src/coalesce_batches.rs
ozankabak Jul 22, 2024
33f9ece
Update datafusion/physical-plan/src/coalesce_batches.rs
ozankabak Jul 22, 2024
46621d5
Update datafusion/core/src/physical_optimizer/limit_pushdown.rs
ozankabak Jul 22, 2024
26a8d3c
Update datafusion/core/src/physical_optimizer/limit_pushdown.rs
ozankabak Jul 22, 2024
d57a3a6
Update datafusion/physical-plan/src/lib.rs
ozankabak Jul 22, 2024
f888826
Implement with_fetch() for other source execs
berkaysynnada Jul 22, 2024
a58d7c2
Merge branch 'tmp' into apache_main
berkaysynnada Jul 22, 2024
a096ea4
Minor
berkaysynnada Jul 22, 2024
0f7aa8d
Merge all Global/Local-LimitExec combinations in LimitPushdown
alihandroid Jul 25, 2024
dd9ad7a
Merge remote-tracking branch 'upstream/main' into apache_main
alihandroid Jul 25, 2024
f9becb6
Fix compile errors after merge
alihandroid Jul 25, 2024
0d01e76
Merge remote-tracking branch 'upstream/main' into apache_main
alihandroid Jul 26, 2024
a4a7794
Update datafusion/core/src/physical_optimizer/limit_pushdown.rs
ozankabak Jul 26, 2024
c4c7276
Avoid code duplication
ozankabak Jul 26, 2024
dcd69b6
Incorporate review feedback
ozankabak Jul 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions datafusion/core/src/dataframe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2132,7 +2132,7 @@ mod tests {
assert_physical_plan(
&df,
vec![
"CoalesceBatchesExec: target_batch_size=8192",
"CoalesceBatchesExec: target_batch_size=8192, fetch=None",
" FilterExec: id@0 = 1 AND name@1 = a",
" AggregateExec: mode=Single, gby=[id@0 as id, name@1 as name], aggr=[]",
" MemoryExec: partitions=1, partition_sizes=[1]",
Expand Down Expand Up @@ -2181,7 +2181,7 @@ mod tests {
assert_physical_plan(
&df,
vec![
"CoalesceBatchesExec: target_batch_size=8192",
"CoalesceBatchesExec: target_batch_size=8192, fetch=None",
" FilterExec: id@0 = 1",
" AggregateExec: mode=Single, gby=[id@0 as id, name@1 as name], aggr=[]",
" MemoryExec: partitions=1, partition_sizes=[1]",
Expand Down Expand Up @@ -2232,7 +2232,7 @@ mod tests {
assert_physical_plan(
&df,
vec![
"CoalesceBatchesExec: target_batch_size=8192",
"CoalesceBatchesExec: target_batch_size=8192, fetch=None",
" FilterExec: id@0 = 1",
" AggregateExec: mode=Single, gby=[id@0 as id], aggr=[]",
" MemoryExec: partitions=1, partition_sizes=[1]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3024,7 +3024,7 @@ pub(crate) mod tests {
// data is already sorted
let expected = &[
"SortPreservingMergeExec: [a@0 ASC]",
"CoalesceBatchesExec: target_batch_size=4096",
"CoalesceBatchesExec: target_batch_size=4096, fetch=None",
"ParquetExec: file_groups={2 groups: [[x], [y]]}, projection=[a, b, c, d, e], output_ordering=[a@0 ASC]",
];
assert_optimized!(expected, exec, true);
Expand All @@ -3036,7 +3036,7 @@ pub(crate) mod tests {
let expected = &[
"SortExec: expr=[a@0 ASC], preserve_partitioning=[false]",
"CoalescePartitionsExec",
"CoalesceBatchesExec: target_batch_size=4096",
"CoalesceBatchesExec: target_batch_size=4096, fetch=None",
"ParquetExec: file_groups={2 groups: [[x], [y]]}, projection=[a, b, c, d, e], output_ordering=[a@0 ASC]",
];
assert_optimized!(expected, exec, false);
Expand Down
4 changes: 2 additions & 2 deletions datafusion/core/src/physical_optimizer/enforce_sorting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,14 +816,14 @@ mod tests {
" FilterExec: NOT non_nullable_col@1",
" SortExec: expr=[non_nullable_col@1 ASC NULLS LAST], preserve_partitioning=[false]",
" BoundedWindowAggExec: wdw=[count: Ok(Field { name: \"count\", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), frame: WindowFrame { units: Range, start_bound: Preceding(NULL), end_bound: CurrentRow, is_causal: false }], mode=[Sorted]",
" CoalesceBatchesExec: target_batch_size=128",
" CoalesceBatchesExec: target_batch_size=128, fetch=None",
" SortExec: expr=[non_nullable_col@1 DESC], preserve_partitioning=[false]",
" MemoryExec: partitions=1, partition_sizes=[0]"];

let expected_optimized = ["WindowAggExec: wdw=[count: Ok(Field { name: \"count\", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), frame: WindowFrame { units: Range, start_bound: CurrentRow, end_bound: Following(NULL), is_causal: false }]",
" FilterExec: NOT non_nullable_col@1",
" BoundedWindowAggExec: wdw=[count: Ok(Field { name: \"count\", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), frame: WindowFrame { units: Range, start_bound: Preceding(NULL), end_bound: CurrentRow, is_causal: false }], mode=[Sorted]",
" CoalesceBatchesExec: target_batch_size=128",
" CoalesceBatchesExec: target_batch_size=128, fetch=None",
" SortExec: expr=[non_nullable_col@1 DESC], preserve_partitioning=[false]",
" MemoryExec: partitions=1, partition_sizes=[0]"];
assert_optimized!(expected_input, expected_optimized, physical_plan, true);
Expand Down
Loading