Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions datafusion/physical-plan/src/sorts/sort_preserving_merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ impl DisplayAs for SortPreservingMergeExec {
write!(f, ", ")?;
}
}

if let Some(fetch) = self.fetch {
writeln!(f)?;
writeln!(f, "limit={fetch}")?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the last one should be just write! rather than writeln! 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could move the previous logic before the PhysicalSortExec iteration, which would be more intuitive.

};

Expand Down
48 changes: 48 additions & 0 deletions datafusion/sqllogictest/test_files/explain_tree.slt
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,54 @@ physical_plan



# query
query TT
explain SELECT * FROM data
WHERE date = '2006-01-02'
ORDER BY "ticker", "time"
LIMIT 5;
----
physical_plan
01)┌───────────────────────────┐
02)│ SortPreservingMergeExec │
03)│ -------------------- │
04)│ limit: 5 │
05)│ │
06)│ ticker ASC NULLS LAST, │
07)│ time ASC NULLS LAST │
08)└─────────────┬─────────────┘
09)┌─────────────┴─────────────┐
10)│ CoalesceBatchesExec │
11)│ -------------------- │
12)│ limit: 5 │
13)│ │
14)│ target_batch_size: │
15)│ 8192 │
16)└─────────────┬─────────────┘
17)┌─────────────┴─────────────┐
18)│ FilterExec │
19)│ -------------------- │
20)│ predicate: │
21)│ date = 2006-01-02 │
22)└─────────────┬─────────────┘
23)┌─────────────┴─────────────┐
24)│ RepartitionExec │
25)│ -------------------- │
26)│ partition_count(in->out): │
27)│ 1 -> 4 │
28)│ │
29)│ partitioning_scheme: │
30)│ RoundRobinBatch(4) │
31)└─────────────┬─────────────┘
32)┌─────────────┴─────────────┐
33)│ StreamingTableExec │
34)│ -------------------- │
35)│ infinite: true │
36)│ limit: None │
37)└───────────────────────────┘




# query
query TT
Expand Down