This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 079ddb04b7 implement tree explain for CoalesceBatchesExec (#15194)
079ddb04b7 is described below

commit 079ddb04b7c36006f571d7253ffd752f8d5a44ff
Author: Alan Tang <[email protected]>
AuthorDate: Thu Mar 13 19:57:04 2025 +0800

    implement tree explain for CoalesceBatchesExec (#15194)
    
    * feat: implement tree explain for CoalesceBatchesExec
    
    Signed-off-by: Alan Tang <[email protected]>
    
    * chore: only fix on tree rendering
    
    Signed-off-by: Alan Tang <[email protected]>
    
    * feat(test): Add tree rendering test for CoalesceBatchesExec with a limit
    
    Signed-off-by: Alan Tang <[email protected]>
    
    ---------
    
    Signed-off-by: Alan Tang <[email protected]>
    Co-authored-by: Andrew Lamb <[email protected]>
---
 datafusion/physical-plan/src/coalesce_batches.rs   |    7 +-
 .../sqllogictest/test_files/explain_tree.slt       | 1346 +++++++++++---------
 2 files changed, 751 insertions(+), 602 deletions(-)

diff --git a/datafusion/physical-plan/src/coalesce_batches.rs 
b/datafusion/physical-plan/src/coalesce_batches.rs
index 0eb95bb665..5244038b9a 100644
--- a/datafusion/physical-plan/src/coalesce_batches.rs
+++ b/datafusion/physical-plan/src/coalesce_batches.rs
@@ -123,8 +123,11 @@ impl DisplayAs for CoalesceBatchesExec {
                 Ok(())
             }
             DisplayFormatType::TreeRender => {
-                // TODO: collect info
-                write!(f, "")
+                writeln!(f, "target_batch_size={}", self.target_batch_size)?;
+                if let Some(fetch) = self.fetch {
+                    write!(f, "limit={fetch}")?;
+                };
+                Ok(())
             }
         }
     }
diff --git a/datafusion/sqllogictest/test_files/explain_tree.slt 
b/datafusion/sqllogictest/test_files/explain_tree.slt
index e61fbf90cd..fbadc3a4f5 100644
--- a/datafusion/sqllogictest/test_files/explain_tree.slt
+++ b/datafusion/sqllogictest/test_files/explain_tree.slt
@@ -142,28 +142,31 @@ explain SELECT int_col FROM table1 WHERE string_col != 
'foo';
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│         FilterExec        │
-06)│    --------------------   │
-07)│         predicate:        │
-08)│    string_col@1 != foo    │
-09)└─────────────┬─────────────┘
-10)┌─────────────┴─────────────┐
-11)│      RepartitionExec      │
-12)│    --------------------   │
-13)│  output_partition_count:  │
-14)│             1             │
-15)│                           │
-16)│    partitioning_scheme:   │
-17)│     RoundRobinBatch(4)    │
-18)└─────────────┬─────────────┘
-19)┌─────────────┴─────────────┐
-20)│       DataSourceExec      │
-21)│    --------------------   │
-22)│          files: 1         │
-23)│        format: csv        │
-24)└───────────────────────────┘
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│         FilterExec        │
+09)│    --------------------   │
+10)│         predicate:        │
+11)│    string_col@1 != foo    │
+12)└─────────────┬─────────────┘
+13)┌─────────────┴─────────────┐
+14)│      RepartitionExec      │
+15)│    --------------------   │
+16)│  output_partition_count:  │
+17)│             1             │
+18)│                           │
+19)│    partitioning_scheme:   │
+20)│     RoundRobinBatch(4)    │
+21)└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐
+23)│       DataSourceExec      │
+24)│    --------------------   │
+25)│          files: 1         │
+26)│        format: csv        │
+27)└───────────────────────────┘
 
 # Aggregate
 query TT
@@ -184,42 +187,45 @@ physical_plan
 12)└─────────────┬─────────────┘
 13)┌─────────────┴─────────────┐
 14)│    CoalesceBatchesExec    │
-15)└─────────────┬─────────────┘
-16)┌─────────────┴─────────────┐
-17)│      RepartitionExec      │
-18)│    --------------------   │
-19)│  output_partition_count:  │
-20)│             4             │
-21)│                           │
-22)│    partitioning_scheme:   │
-23)│  Hash([string_col@0], 4)  │
-24)└─────────────┬─────────────┘
-25)┌─────────────┴─────────────┐
-26)│       AggregateExec       │
-27)│    --------------------   │
-28)│           aggr:           │
-29)│   sum(table1.bigint_col)  │
-30)│                           │
-31)│         group_by:         │
-32)│ string_col@0 as string_col│
+15)│    --------------------   │
+16)│     target_batch_size:    │
+17)│            8192           │
+18)└─────────────┬─────────────┘
+19)┌─────────────┴─────────────┐
+20)│      RepartitionExec      │
+21)│    --------------------   │
+22)│  output_partition_count:  │
+23)│             4             │
+24)│                           │
+25)│    partitioning_scheme:   │
+26)│  Hash([string_col@0], 4)  │
+27)└─────────────┬─────────────┘
+28)┌─────────────┴─────────────┐
+29)│       AggregateExec       │
+30)│    --------------------   │
+31)│           aggr:           │
+32)│   sum(table1.bigint_col)  │
 33)│                           │
-34)│       mode: Partial       │
-35)└─────────────┬─────────────┘
-36)┌─────────────┴─────────────┐
-37)│      RepartitionExec      │
-38)│    --------------------   │
-39)│  output_partition_count:  │
-40)│             1             │
-41)│                           │
-42)│    partitioning_scheme:   │
-43)│     RoundRobinBatch(4)    │
-44)└─────────────┬─────────────┘
-45)┌─────────────┴─────────────┐
-46)│       DataSourceExec      │
-47)│    --------------------   │
-48)│          files: 1         │
-49)│        format: csv        │
-50)└───────────────────────────┘
+34)│         group_by:         │
+35)│ string_col@0 as string_col│
+36)│                           │
+37)│       mode: Partial       │
+38)└─────────────┬─────────────┘
+39)┌─────────────┴─────────────┐
+40)│      RepartitionExec      │
+41)│    --------------------   │
+42)│  output_partition_count:  │
+43)│             1             │
+44)│                           │
+45)│    partitioning_scheme:   │
+46)│     RoundRobinBatch(4)    │
+47)└─────────────┬─────────────┘
+48)┌─────────────┴─────────────┐
+49)│       DataSourceExec      │
+50)│    --------------------   │
+51)│          files: 1         │
+52)│        format: csv        │
+53)└───────────────────────────┘
 
 
 # Limit
@@ -247,40 +253,46 @@ explain SELECT table1.string_col, table2.date_col FROM 
table1 JOIN table2 ON tab
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│        HashJoinExec       │
-06)│    --------------------   │
-07)│            on:            ├──────────────┐
-08)│  (int_col@0 = int_col@0)  │              │
-09)└─────────────┬─────────────┘              │
-10)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-11)│    CoalesceBatchesExec    ││    CoalesceBatchesExec    │
-12)└─────────────┬─────────────┘└─────────────┬─────────────┘
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│        HashJoinExec       │
+09)│    --------------------   │
+10)│            on:            ├──────────────┐
+11)│  (int_col@0 = int_col@0)  │              │
+12)└─────────────┬─────────────┘              │
 13)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-14)│      RepartitionExec      ││      RepartitionExec      │
+14)│    CoalesceBatchesExec    ││    CoalesceBatchesExec    │
 15)│    --------------------   ││    --------------------   │
-16)│  output_partition_count:  ││  output_partition_count:  │
-17)│             4             ││             4             │
-18)│                           ││                           │
-19)│    partitioning_scheme:   ││    partitioning_scheme:   │
-20)│    Hash([int_col@0], 4)   ││    Hash([int_col@0], 4)   │
-21)└─────────────┬─────────────┘└─────────────┬─────────────┘
-22)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-23)│      RepartitionExec      ││      RepartitionExec      │
-24)│    --------------------   ││    --------------------   │
-25)│  output_partition_count:  ││  output_partition_count:  │
-26)│             1             ││             1             │
-27)│                           ││                           │
-28)│    partitioning_scheme:   ││    partitioning_scheme:   │
-29)│     RoundRobinBatch(4)    ││     RoundRobinBatch(4)    │
-30)└─────────────┬─────────────┘└─────────────┬─────────────┘
-31)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-32)│       DataSourceExec      ││       DataSourceExec      │
-33)│    --------------------   ││    --------------------   │
-34)│          files: 1         ││          files: 1         │
-35)│        format: csv        ││      format: parquet      │
-36)└───────────────────────────┘└───────────────────────────┘
+16)│     target_batch_size:    ││     target_batch_size:    │
+17)│            8192           ││            8192           │
+18)└─────────────┬─────────────┘└─────────────┬─────────────┘
+19)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+20)│      RepartitionExec      ││      RepartitionExec      │
+21)│    --------------------   ││    --------------------   │
+22)│  output_partition_count:  ││  output_partition_count:  │
+23)│             4             ││             4             │
+24)│                           ││                           │
+25)│    partitioning_scheme:   ││    partitioning_scheme:   │
+26)│    Hash([int_col@0], 4)   ││    Hash([int_col@0], 4)   │
+27)└─────────────┬─────────────┘└─────────────┬─────────────┘
+28)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+29)│      RepartitionExec      ││      RepartitionExec      │
+30)│    --------------------   ││    --------------------   │
+31)│  output_partition_count:  ││  output_partition_count:  │
+32)│             1             ││             1             │
+33)│                           ││                           │
+34)│    partitioning_scheme:   ││    partitioning_scheme:   │
+35)│     RoundRobinBatch(4)    ││     RoundRobinBatch(4)    │
+36)└─────────────┬─────────────┘└─────────────┬─────────────┘
+37)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+38)│       DataSourceExec      ││       DataSourceExec      │
+39)│    --------------------   ││    --------------------   │
+40)│          files: 1         ││          files: 1         │
+41)│        format: csv        ││      format: parquet      │
+42)└───────────────────────────┘└───────────────────────────┘
 
 # 3 Joins
 query TT
@@ -295,56 +307,62 @@ FROM
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│        HashJoinExec       │
-06)│    --------------------   │
-07)│            on:            ├───────────────────────────────────────────┐
-08)│  (int_col@1 = int_col@0)  │                                           │
-09)└─────────────┬─────────────┘                                           │
-10)┌─────────────┴─────────────┐                             
┌─────────────┴─────────────┐
-11)│    CoalesceBatchesExec    │                             │    
CoalesceBatchesExec    │
-12)└─────────────┬─────────────┘                             
└─────────────┬─────────────┘
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│        HashJoinExec       │
+09)│    --------------------   │
+10)│            on:            ├───────────────────────────────────────────┐
+11)│  (int_col@1 = int_col@0)  │                                           │
+12)└─────────────┬─────────────┘                                           │
 13)┌─────────────┴─────────────┐                             
┌─────────────┴─────────────┐
-14)│        HashJoinExec       │                             │      
RepartitionExec      │
+14)│    CoalesceBatchesExec    │                             │    
CoalesceBatchesExec    │
 15)│    --------------------   │                             │    
--------------------   │
-16)│            on:            │                             │  
output_partition_count:  │
-17)│  (int_col@0 = int_col@0)  ├──────────────┐              │             1   
          │
-18)│                           │              │              │                 
          │
-19)│                           │              │              │    
partitioning_scheme:   │
-20)│                           │              │              │    
Hash([int_col@0], 4)   │
-21)└─────────────┬─────────────┘              │              
└─────────────┬─────────────┘
-22)┌─────────────┴─────────────┐┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-23)│    CoalesceBatchesExec    ││    CoalesceBatchesExec    ││       
DataSourceExec      │
-24)│                           ││                           ││    
--------------------   │
-25)│                           ││                           ││        bytes: 
1560        │
-26)│                           ││                           ││       format: 
memory      │
-27)│                           ││                           ││          rows: 
1          │
-28)└─────────────┬─────────────┘└─────────────┬─────────────┘└───────────────────────────┘
-29)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-30)│      RepartitionExec      ││      RepartitionExec      │
-31)│    --------------------   ││    --------------------   │
-32)│  output_partition_count:  ││  output_partition_count:  │
-33)│             4             ││             4             │
-34)│                           ││                           │
-35)│    partitioning_scheme:   ││    partitioning_scheme:   │
-36)│    Hash([int_col@0], 4)   ││    Hash([int_col@0], 4)   │
-37)└─────────────┬─────────────┘└─────────────┬─────────────┘
-38)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-39)│      RepartitionExec      ││      RepartitionExec      │
-40)│    --------------------   ││    --------------------   │
-41)│  output_partition_count:  ││  output_partition_count:  │
-42)│             1             ││             1             │
-43)│                           ││                           │
-44)│    partitioning_scheme:   ││    partitioning_scheme:   │
-45)│     RoundRobinBatch(4)    ││     RoundRobinBatch(4)    │
-46)└─────────────┬─────────────┘└─────────────┬─────────────┘
-47)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-48)│       DataSourceExec      ││       DataSourceExec      │
-49)│    --------------------   ││    --------------------   │
-50)│          files: 1         ││          files: 1         │
-51)│        format: csv        ││      format: parquet      │
-52)└───────────────────────────┘└───────────────────────────┘
+16)│     target_batch_size:    │                             │     
target_batch_size:    │
+17)│            8192           │                             │            8192 
          │
+18)└─────────────┬─────────────┘                             
└─────────────┬─────────────┘
+19)┌─────────────┴─────────────┐                             
┌─────────────┴─────────────┐
+20)│        HashJoinExec       │                             │      
RepartitionExec      │
+21)│    --------------------   │                             │    
--------------------   │
+22)│            on:            │                             │  
output_partition_count:  │
+23)│  (int_col@0 = int_col@0)  ├──────────────┐              │             1   
          │
+24)│                           │              │              │                 
          │
+25)│                           │              │              │    
partitioning_scheme:   │
+26)│                           │              │              │    
Hash([int_col@0], 4)   │
+27)└─────────────┬─────────────┘              │              
└─────────────┬─────────────┘
+28)┌─────────────┴─────────────┐┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+29)│    CoalesceBatchesExec    ││    CoalesceBatchesExec    ││       
DataSourceExec      │
+30)│    --------------------   ││    --------------------   ││    
--------------------   │
+31)│     target_batch_size:    ││     target_batch_size:    ││        bytes: 
1560        │
+32)│            8192           ││            8192           ││       format: 
memory      │
+33)│                           ││                           ││          rows: 
1          │
+34)└─────────────┬─────────────┘└─────────────┬─────────────┘└───────────────────────────┘
+35)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+36)│      RepartitionExec      ││      RepartitionExec      │
+37)│    --------------------   ││    --------------------   │
+38)│  output_partition_count:  ││  output_partition_count:  │
+39)│             4             ││             4             │
+40)│                           ││                           │
+41)│    partitioning_scheme:   ││    partitioning_scheme:   │
+42)│    Hash([int_col@0], 4)   ││    Hash([int_col@0], 4)   │
+43)└─────────────┬─────────────┘└─────────────┬─────────────┘
+44)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+45)│      RepartitionExec      ││      RepartitionExec      │
+46)│    --------------------   ││    --------------------   │
+47)│  output_partition_count:  ││  output_partition_count:  │
+48)│             1             ││             1             │
+49)│                           ││                           │
+50)│    partitioning_scheme:   ││    partitioning_scheme:   │
+51)│     RoundRobinBatch(4)    ││     RoundRobinBatch(4)    │
+52)└─────────────┬─────────────┘└─────────────┬─────────────┘
+53)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+54)│       DataSourceExec      ││       DataSourceExec      │
+55)│    --------------------   ││    --------------------   │
+56)│          files: 1         ││          files: 1         │
+57)│        format: csv        ││      format: parquet      │
+58)└───────────────────────────┘└───────────────────────────┘
 
 # Long Filter (demonstrate what happens with wrapping)
 query TT
@@ -355,32 +373,35 @@ WHERE string_col != 'foo' AND string_col != 'bar' AND 
string_col != 'a really lo
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│         FilterExec        │
-06)│    --------------------   │
-07)│         predicate:        │
-08)│  string_col@1 != foo AND  │
-09)│     string_col@1 != bar   │
-10)│    AND string_col@1 != a  │
-11)│     really long string    │
-12)│          constant         │
-13)└─────────────┬─────────────┘
-14)┌─────────────┴─────────────┐
-15)│      RepartitionExec      │
-16)│    --------------------   │
-17)│  output_partition_count:  │
-18)│             1             │
-19)│                           │
-20)│    partitioning_scheme:   │
-21)│     RoundRobinBatch(4)    │
-22)└─────────────┬─────────────┘
-23)┌─────────────┴─────────────┐
-24)│       DataSourceExec      │
-25)│    --------------------   │
-26)│          files: 1         │
-27)│        format: csv        │
-28)└───────────────────────────┘
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│         FilterExec        │
+09)│    --------------------   │
+10)│         predicate:        │
+11)│  string_col@1 != foo AND  │
+12)│     string_col@1 != bar   │
+13)│    AND string_col@1 != a  │
+14)│     really long string    │
+15)│          constant         │
+16)└─────────────┬─────────────┘
+17)┌─────────────┴─────────────┐
+18)│      RepartitionExec      │
+19)│    --------------------   │
+20)│  output_partition_count:  │
+21)│             1             │
+22)│                           │
+23)│    partitioning_scheme:   │
+24)│     RoundRobinBatch(4)    │
+25)└─────────────┬─────────────┘
+26)┌─────────────┴─────────────┐
+27)│       DataSourceExec      │
+28)│    --------------------   │
+29)│          files: 1         │
+30)│        format: csv        │
+31)└───────────────────────────┘
 
 # Check maximum line limit.
 query TT
@@ -390,16 +411,16 @@ WHERE string_col != 
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│         FilterExec        │
-06)│    --------------------   │
-07)│         predicate:        │
-08)│      string_col@1 !=      │
-09)│       aaaaaaaaaaaaaa      │
-10)│aaaaaaaaaaaaaaaaaaaaaaaaaaa│
-11)│aaaaaaaaaaaaaaaaaaaaaaaaaaa│
-12)│aaaaaaaaaaaaaaaaaaaaaaaaaaa│
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│         FilterExec        │
+09)│    --------------------   │
+10)│         predicate:        │
+11)│      string_col@1 !=      │
+12)│       aaaaaaaaaaaaaa      │
 13)│aaaaaaaaaaaaaaaaaaaaaaaaaaa│
 14)│aaaaaaaaaaaaaaaaaaaaaaaaaaa│
 15)│aaaaaaaaaaaaaaaaaaaaaaaaaaa│
@@ -423,23 +444,26 @@ physical_plan
 33)│aaaaaaaaaaaaaaaaaaaaaaaaaaa│
 34)│aaaaaaaaaaaaaaaaaaaaaaaaaaa│
 35)│aaaaaaaaaaaaaaaaaaaaaaaaaaa│
-36)│            ...            │
-37)└─────────────┬─────────────┘
-38)┌─────────────┴─────────────┐
-39)│      RepartitionExec      │
-40)│    --------------------   │
-41)│  output_partition_count:  │
-42)│             1             │
-43)│                           │
-44)│    partitioning_scheme:   │
-45)│     RoundRobinBatch(4)    │
-46)└─────────────┬─────────────┘
-47)┌─────────────┴─────────────┐
-48)│       DataSourceExec      │
-49)│    --------------------   │
-50)│          files: 1         │
-51)│        format: csv        │
-52)└───────────────────────────┘
+36)│aaaaaaaaaaaaaaaaaaaaaaaaaaa│
+37)│aaaaaaaaaaaaaaaaaaaaaaaaaaa│
+38)│aaaaaaaaaaaaaaaaaaaaaaaaaaa│
+39)│            ...            │
+40)└─────────────┬─────────────┘
+41)┌─────────────┴─────────────┐
+42)│      RepartitionExec      │
+43)│    --------------------   │
+44)│  output_partition_count:  │
+45)│             1             │
+46)│                           │
+47)│    partitioning_scheme:   │
+48)│     RoundRobinBatch(4)    │
+49)└─────────────┬─────────────┘
+50)┌─────────────┴─────────────┐
+51)│       DataSourceExec      │
+52)│    --------------------   │
+53)│          files: 1         │
+54)│        format: csv        │
+55)└───────────────────────────┘
 
 # Check exactly the render width.
 query TT
@@ -449,28 +473,31 @@ WHERE string_col != 'aaaaaaaaaaa';
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│         FilterExec        │
-06)│    --------------------   │
-07)│         predicate:        │
-08)│string_col@1 != aaaaaaaaaaa│
-09)└─────────────┬─────────────┘
-10)┌─────────────┴─────────────┐
-11)│      RepartitionExec      │
-12)│    --------------------   │
-13)│  output_partition_count:  │
-14)│             1             │
-15)│                           │
-16)│    partitioning_scheme:   │
-17)│     RoundRobinBatch(4)    │
-18)└─────────────┬─────────────┘
-19)┌─────────────┴─────────────┐
-20)│       DataSourceExec      │
-21)│    --------------------   │
-22)│          files: 1         │
-23)│        format: csv        │
-24)└───────────────────────────┘
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│         FilterExec        │
+09)│    --------------------   │
+10)│         predicate:        │
+11)│string_col@1 != aaaaaaaaaaa│
+12)└─────────────┬─────────────┘
+13)┌─────────────┴─────────────┐
+14)│      RepartitionExec      │
+15)│    --------------------   │
+16)│  output_partition_count:  │
+17)│             1             │
+18)│                           │
+19)│    partitioning_scheme:   │
+20)│     RoundRobinBatch(4)    │
+21)└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐
+23)│       DataSourceExec      │
+24)│    --------------------   │
+25)│          files: 1         │
+26)│        format: csv        │
+27)└───────────────────────────┘
 
 # Check with the render witdth + 1.
 query TT
@@ -480,29 +507,32 @@ WHERE string_col != 'aaaaaaaaaaaa';
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│         FilterExec        │
-06)│    --------------------   │
-07)│         predicate:        │
-08)│      string_col@1 !=      │
-09)│        aaaaaaaaaaaa       │
-10)└─────────────┬─────────────┘
-11)┌─────────────┴─────────────┐
-12)│      RepartitionExec      │
-13)│    --------------------   │
-14)│  output_partition_count:  │
-15)│             1             │
-16)│                           │
-17)│    partitioning_scheme:   │
-18)│     RoundRobinBatch(4)    │
-19)└─────────────┬─────────────┘
-20)┌─────────────┴─────────────┐
-21)│       DataSourceExec      │
-22)│    --------------------   │
-23)│          files: 1         │
-24)│        format: csv        │
-25)└───────────────────────────┘
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│         FilterExec        │
+09)│    --------------------   │
+10)│         predicate:        │
+11)│      string_col@1 !=      │
+12)│        aaaaaaaaaaaa       │
+13)└─────────────┬─────────────┘
+14)┌─────────────┴─────────────┐
+15)│      RepartitionExec      │
+16)│    --------------------   │
+17)│  output_partition_count:  │
+18)│             1             │
+19)│                           │
+20)│    partitioning_scheme:   │
+21)│     RoundRobinBatch(4)    │
+22)└─────────────┬─────────────┘
+23)┌─────────────┴─────────────┐
+24)│       DataSourceExec      │
+25)│    --------------------   │
+26)│          files: 1         │
+27)│        format: csv        │
+28)└───────────────────────────┘
 
 # Query with filter on csv
 query TT
@@ -511,28 +541,31 @@ explain SELECT int_col FROM table1 WHERE string_col != 
'foo';
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│         FilterExec        │
-06)│    --------------------   │
-07)│         predicate:        │
-08)│    string_col@1 != foo    │
-09)└─────────────┬─────────────┘
-10)┌─────────────┴─────────────┐
-11)│      RepartitionExec      │
-12)│    --------------------   │
-13)│  output_partition_count:  │
-14)│             1             │
-15)│                           │
-16)│    partitioning_scheme:   │
-17)│     RoundRobinBatch(4)    │
-18)└─────────────┬─────────────┘
-19)┌─────────────┴─────────────┐
-20)│       DataSourceExec      │
-21)│    --------------------   │
-22)│          files: 1         │
-23)│        format: csv        │
-24)└───────────────────────────┘
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│         FilterExec        │
+09)│    --------------------   │
+10)│         predicate:        │
+11)│    string_col@1 != foo    │
+12)└─────────────┬─────────────┘
+13)┌─────────────┴─────────────┐
+14)│      RepartitionExec      │
+15)│    --------------------   │
+16)│  output_partition_count:  │
+17)│             1             │
+18)│                           │
+19)│    partitioning_scheme:   │
+20)│     RoundRobinBatch(4)    │
+21)└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐
+23)│       DataSourceExec      │
+24)│    --------------------   │
+25)│          files: 1         │
+26)│        format: csv        │
+27)└───────────────────────────┘
 
 
 # Query with filter on parquet
@@ -542,31 +575,34 @@ explain SELECT int_col FROM table2 WHERE string_col != 
'foo';
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│         FilterExec        │
-06)│    --------------------   │
-07)│         predicate:        │
-08)│    string_col@1 != foo    │
-09)└─────────────┬─────────────┘
-10)┌─────────────┴─────────────┐
-11)│      RepartitionExec      │
-12)│    --------------------   │
-13)│  output_partition_count:  │
-14)│             1             │
-15)│                           │
-16)│    partitioning_scheme:   │
-17)│     RoundRobinBatch(4)    │
-18)└─────────────┬─────────────┘
-19)┌─────────────┴─────────────┐
-20)│       DataSourceExec      │
-21)│    --------------------   │
-22)│          files: 1         │
-23)│      format: parquet      │
-24)│                           │
-25)│         predicate:        │
-26)│    string_col@1 != foo    │
-27)└───────────────────────────┘
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│         FilterExec        │
+09)│    --------------------   │
+10)│         predicate:        │
+11)│    string_col@1 != foo    │
+12)└─────────────┬─────────────┘
+13)┌─────────────┴─────────────┐
+14)│      RepartitionExec      │
+15)│    --------------------   │
+16)│  output_partition_count:  │
+17)│             1             │
+18)│                           │
+19)│    partitioning_scheme:   │
+20)│     RoundRobinBatch(4)    │
+21)└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐
+23)│       DataSourceExec      │
+24)│    --------------------   │
+25)│          files: 1         │
+26)│      format: parquet      │
+27)│                           │
+28)│         predicate:        │
+29)│    string_col@1 != foo    │
+30)└───────────────────────────┘
 
 # Query with filter on memory
 query TT
@@ -575,20 +611,23 @@ explain SELECT int_col FROM table3 WHERE string_col != 
'foo';
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│         FilterExec        │
-06)│    --------------------   │
-07)│         predicate:        │
-08)│    string_col@1 != foo    │
-09)└─────────────┬─────────────┘
-10)┌─────────────┴─────────────┐
-11)│       DataSourceExec      │
-12)│    --------------------   │
-13)│        bytes: 1560        │
-14)│       format: memory      │
-15)│          rows: 1          │
-16)└───────────────────────────┘
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│         FilterExec        │
+09)│    --------------------   │
+10)│         predicate:        │
+11)│    string_col@1 != foo    │
+12)└─────────────┬─────────────┘
+13)┌─────────────┴─────────────┐
+14)│       DataSourceExec      │
+15)│    --------------------   │
+16)│        bytes: 1560        │
+17)│       format: memory      │
+18)│          rows: 1          │
+19)└───────────────────────────┘
 
 # Query with filter on json
 query TT
@@ -597,28 +636,31 @@ explain SELECT int_col FROM table4 WHERE string_col != 
'foo';
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│         FilterExec        │
-06)│    --------------------   │
-07)│         predicate:        │
-08)│    string_col@1 != foo    │
-09)└─────────────┬─────────────┘
-10)┌─────────────┴─────────────┐
-11)│      RepartitionExec      │
-12)│    --------------------   │
-13)│  output_partition_count:  │
-14)│             1             │
-15)│                           │
-16)│    partitioning_scheme:   │
-17)│     RoundRobinBatch(4)    │
-18)└─────────────┬─────────────┘
-19)┌─────────────┴─────────────┐
-20)│       DataSourceExec      │
-21)│    --------------------   │
-22)│          files: 1         │
-23)│        format: json       │
-24)└───────────────────────────┘
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│         FilterExec        │
+09)│    --------------------   │
+10)│         predicate:        │
+11)│    string_col@1 != foo    │
+12)└─────────────┬─────────────┘
+13)┌─────────────┴─────────────┐
+14)│      RepartitionExec      │
+15)│    --------------------   │
+16)│  output_partition_count:  │
+17)│             1             │
+18)│                           │
+19)│    partitioning_scheme:   │
+20)│     RoundRobinBatch(4)    │
+21)└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐
+23)│       DataSourceExec      │
+24)│    --------------------   │
+25)│          files: 1         │
+26)│        format: json       │
+27)└───────────────────────────┘
 
 # Query with filter on arrow
 query TT
@@ -627,28 +669,31 @@ explain SELECT int_col FROM table5 WHERE string_col != 
'foo';
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│         FilterExec        │
-06)│    --------------------   │
-07)│         predicate:        │
-08)│    string_col@1 != foo    │
-09)└─────────────┬─────────────┘
-10)┌─────────────┴─────────────┐
-11)│      RepartitionExec      │
-12)│    --------------------   │
-13)│  output_partition_count:  │
-14)│             1             │
-15)│                           │
-16)│    partitioning_scheme:   │
-17)│     RoundRobinBatch(4)    │
-18)└─────────────┬─────────────┘
-19)┌─────────────┴─────────────┐
-20)│       DataSourceExec      │
-21)│    --------------------   │
-22)│          files: 1         │
-23)│       format: arrow       │
-24)└───────────────────────────┘
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│         FilterExec        │
+09)│    --------------------   │
+10)│         predicate:        │
+11)│    string_col@1 != foo    │
+12)└─────────────┬─────────────┘
+13)┌─────────────┴─────────────┐
+14)│      RepartitionExec      │
+15)│    --------------------   │
+16)│  output_partition_count:  │
+17)│             1             │
+18)│                           │
+19)│    partitioning_scheme:   │
+20)│     RoundRobinBatch(4)    │
+21)└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐
+23)│       DataSourceExec      │
+24)│    --------------------   │
+25)│          files: 1         │
+26)│       format: arrow       │
+27)└───────────────────────────┘
 
 
 # Query with window agg.
@@ -1097,62 +1142,68 @@ explain select * from table1 inner join table2 on 
table1.int_col = table2.int_co
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│        HashJoinExec       │
-06)│    --------------------   │
-07)│            on:            │
-08)│ (int_col@0 = int_col@0),  ├──────────────┐
-09)│  (CAST(table1.string_col  │              │
-10)│      AS Utf8View)@4 =     │              │
-11)│        string_col@1)      │              │
-12)└─────────────┬─────────────┘              │
-13)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-14)│    CoalesceBatchesExec    ││    CoalesceBatchesExec    │
-15)└─────────────┬─────────────┘└─────────────┬─────────────┘
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│        HashJoinExec       │
+09)│    --------------------   │
+10)│            on:            │
+11)│ (int_col@0 = int_col@0),  ├──────────────┐
+12)│  (CAST(table1.string_col  │              │
+13)│      AS Utf8View)@4 =     │              │
+14)│        string_col@1)      │              │
+15)└─────────────┬─────────────┘              │
 16)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-17)│      RepartitionExec      ││      RepartitionExec      │
+17)│    CoalesceBatchesExec    ││    CoalesceBatchesExec    │
 18)│    --------------------   ││    --------------------   │
-19)│  output_partition_count:  ││  output_partition_count:  │
-20)│             4             ││             4             │
-21)│                           ││                           │
-22)│    partitioning_scheme:   ││    partitioning_scheme:   │
-23)│   Hash([int_col@0, CAST   ││      Hash([int_col@0,     │
-24)│     (table1.string_col    ││       string_col@1],      │
-25)│     AS Utf8View)@4], 4)   ││             4)            │
-26)└─────────────┬─────────────┘└─────────────┬─────────────┘
-27)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-28)│       ProjectionExec      ││      RepartitionExec      │
-29)│    --------------------   ││    --------------------   │
-30)│ CAST(table1.string_col AS ││  output_partition_count:  │
-31)│         Utf8View):        ││             1             │
-32)│    CAST(string_col@1 AS   ││                           │
-33)│          Utf8View)        ││    partitioning_scheme:   │
-34)│                           ││     RoundRobinBatch(4)    │
-35)│        bigint_col:        ││                           │
-36)│        bigint_col@2       ││                           │
-37)│                           ││                           │
-38)│    date_col: date_col@3   ││                           │
-39)│     int_col: int_col@0    ││                           │
-40)│                           ││                           │
-41)│        string_col:        ││                           │
-42)│        string_col@1       ││                           │
-43)└─────────────┬─────────────┘└─────────────┬─────────────┘
-44)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-45)│      RepartitionExec      ││       DataSourceExec      │
-46)│    --------------------   ││    --------------------   │
-47)│  output_partition_count:  ││          files: 1         │
-48)│             1             ││      format: parquet      │
-49)│                           ││                           │
-50)│    partitioning_scheme:   ││                           │
-51)│     RoundRobinBatch(4)    ││                           │
-52)└─────────────┬─────────────┘└───────────────────────────┘
-53)┌─────────────┴─────────────┐
-54)│       DataSourceExec      │
-55)│    --------------------   │
-56)│          files: 1         │
-57)│        format: csv        │
-58)└───────────────────────────┘
+19)│     target_batch_size:    ││     target_batch_size:    │
+20)│            8192           ││            8192           │
+21)└─────────────┬─────────────┘└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+23)│      RepartitionExec      ││      RepartitionExec      │
+24)│    --------------------   ││    --------------------   │
+25)│  output_partition_count:  ││  output_partition_count:  │
+26)│             4             ││             4             │
+27)│                           ││                           │
+28)│    partitioning_scheme:   ││    partitioning_scheme:   │
+29)│   Hash([int_col@0, CAST   ││      Hash([int_col@0,     │
+30)│     (table1.string_col    ││       string_col@1],      │
+31)│     AS Utf8View)@4], 4)   ││             4)            │
+32)└─────────────┬─────────────┘└─────────────┬─────────────┘
+33)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+34)│       ProjectionExec      ││      RepartitionExec      │
+35)│    --------------------   ││    --------------------   │
+36)│ CAST(table1.string_col AS ││  output_partition_count:  │
+37)│         Utf8View):        ││             1             │
+38)│    CAST(string_col@1 AS   ││                           │
+39)│          Utf8View)        ││    partitioning_scheme:   │
+40)│                           ││     RoundRobinBatch(4)    │
+41)│        bigint_col:        ││                           │
+42)│        bigint_col@2       ││                           │
+43)│                           ││                           │
+44)│    date_col: date_col@3   ││                           │
+45)│     int_col: int_col@0    ││                           │
+46)│                           ││                           │
+47)│        string_col:        ││                           │
+48)│        string_col@1       ││                           │
+49)└─────────────┬─────────────┘└─────────────┬─────────────┘
+50)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+51)│      RepartitionExec      ││       DataSourceExec      │
+52)│    --------------------   ││    --------------------   │
+53)│  output_partition_count:  ││          files: 1         │
+54)│             1             ││      format: parquet      │
+55)│                           ││                           │
+56)│    partitioning_scheme:   ││                           │
+57)│     RoundRobinBatch(4)    ││                           │
+58)└─────────────┬─────────────┘└───────────────────────────┘
+59)┌─────────────┴─────────────┐
+60)│       DataSourceExec      │
+61)│    --------------------   │
+62)│          files: 1         │
+63)│        format: csv        │
+64)└───────────────────────────┘
 
 # Query with outer hash join.
 query TT
@@ -1161,64 +1212,70 @@ explain select * from table1 left outer join table2 on 
table1.int_col = table2.i
 physical_plan
 01)┌───────────────────────────┐
 02)│    CoalesceBatchesExec    │
-03)└─────────────┬─────────────┘
-04)┌─────────────┴─────────────┐
-05)│        HashJoinExec       │
-06)│    --------------------   │
-07)│      join_type: Left      │
-08)│                           │
-09)│            on:            ├──────────────┐
-10)│ (int_col@0 = int_col@0),  │              │
-11)│  (CAST(table1.string_col  │              │
-12)│      AS Utf8View)@4 =     │              │
-13)│        string_col@1)      │              │
-14)└─────────────┬─────────────┘              │
-15)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-16)│    CoalesceBatchesExec    ││    CoalesceBatchesExec    │
-17)└─────────────┬─────────────┘└─────────────┬─────────────┘
+03)│    --------------------   │
+04)│     target_batch_size:    │
+05)│            8192           │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│        HashJoinExec       │
+09)│    --------------------   │
+10)│      join_type: Left      │
+11)│                           │
+12)│            on:            ├──────────────┐
+13)│ (int_col@0 = int_col@0),  │              │
+14)│  (CAST(table1.string_col  │              │
+15)│      AS Utf8View)@4 =     │              │
+16)│        string_col@1)      │              │
+17)└─────────────┬─────────────┘              │
 18)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-19)│      RepartitionExec      ││      RepartitionExec      │
+19)│    CoalesceBatchesExec    ││    CoalesceBatchesExec    │
 20)│    --------------------   ││    --------------------   │
-21)│  output_partition_count:  ││  output_partition_count:  │
-22)│             4             ││             4             │
-23)│                           ││                           │
-24)│    partitioning_scheme:   ││    partitioning_scheme:   │
-25)│   Hash([int_col@0, CAST   ││      Hash([int_col@0,     │
-26)│     (table1.string_col    ││       string_col@1],      │
-27)│     AS Utf8View)@4], 4)   ││             4)            │
-28)└─────────────┬─────────────┘└─────────────┬─────────────┘
-29)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-30)│       ProjectionExec      ││      RepartitionExec      │
-31)│    --------------------   ││    --------------------   │
-32)│ CAST(table1.string_col AS ││  output_partition_count:  │
-33)│         Utf8View):        ││             1             │
-34)│    CAST(string_col@1 AS   ││                           │
-35)│          Utf8View)        ││    partitioning_scheme:   │
-36)│                           ││     RoundRobinBatch(4)    │
-37)│        bigint_col:        ││                           │
-38)│        bigint_col@2       ││                           │
-39)│                           ││                           │
-40)│    date_col: date_col@3   ││                           │
-41)│     int_col: int_col@0    ││                           │
-42)│                           ││                           │
-43)│        string_col:        ││                           │
-44)│        string_col@1       ││                           │
-45)└─────────────┬─────────────┘└─────────────┬─────────────┘
-46)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-47)│      RepartitionExec      ││       DataSourceExec      │
-48)│    --------------------   ││    --------------------   │
-49)│  output_partition_count:  ││          files: 1         │
-50)│             1             ││      format: parquet      │
-51)│                           ││                           │
-52)│    partitioning_scheme:   ││                           │
-53)│     RoundRobinBatch(4)    ││                           │
-54)└─────────────┬─────────────┘└───────────────────────────┘
-55)┌─────────────┴─────────────┐
-56)│       DataSourceExec      │
-57)│    --------------------   │
-58)│          files: 1         │
-59)│        format: csv        │
-60)└───────────────────────────┘
+21)│     target_batch_size:    ││     target_batch_size:    │
+22)│            8192           ││            8192           │
+23)└─────────────┬─────────────┘└─────────────┬─────────────┘
+24)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+25)│      RepartitionExec      ││      RepartitionExec      │
+26)│    --------------------   ││    --------------------   │
+27)│  output_partition_count:  ││  output_partition_count:  │
+28)│             4             ││             4             │
+29)│                           ││                           │
+30)│    partitioning_scheme:   ││    partitioning_scheme:   │
+31)│   Hash([int_col@0, CAST   ││      Hash([int_col@0,     │
+32)│     (table1.string_col    ││       string_col@1],      │
+33)│     AS Utf8View)@4], 4)   ││             4)            │
+34)└─────────────┬─────────────┘└─────────────┬─────────────┘
+35)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+36)│       ProjectionExec      ││      RepartitionExec      │
+37)│    --------------------   ││    --------------------   │
+38)│ CAST(table1.string_col AS ││  output_partition_count:  │
+39)│         Utf8View):        ││             1             │
+40)│    CAST(string_col@1 AS   ││                           │
+41)│          Utf8View)        ││    partitioning_scheme:   │
+42)│                           ││     RoundRobinBatch(4)    │
+43)│        bigint_col:        ││                           │
+44)│        bigint_col@2       ││                           │
+45)│                           ││                           │
+46)│    date_col: date_col@3   ││                           │
+47)│     int_col: int_col@0    ││                           │
+48)│                           ││                           │
+49)│        string_col:        ││                           │
+50)│        string_col@1       ││                           │
+51)└─────────────┬─────────────┘└─────────────┬─────────────┘
+52)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+53)│      RepartitionExec      ││       DataSourceExec      │
+54)│    --------------------   ││    --------------------   │
+55)│  output_partition_count:  ││          files: 1         │
+56)│             1             ││      format: parquet      │
+57)│                           ││                           │
+58)│    partitioning_scheme:   ││                           │
+59)│     RoundRobinBatch(4)    ││                           │
+60)└─────────────┬─────────────┘└───────────────────────────┘
+61)┌─────────────┴─────────────┐
+62)│       DataSourceExec      │
+63)│    --------------------   │
+64)│          files: 1         │
+65)│        format: csv        │
+66)└───────────────────────────┘
 
 # Query with nested loop join.
 query TT
@@ -1364,28 +1421,31 @@ physical_plan
 06)└─────────────┬─────────────┘
 07)┌─────────────┴─────────────┐
 08)│    CoalesceBatchesExec    │
-09)└─────────────┬─────────────┘
-10)┌─────────────┴─────────────┐
-11)│         FilterExec        │
-12)│    --------------------   │
-13)│         predicate:        │
-14)│        ticker@1 = A       │
-15)└─────────────┬─────────────┘
-16)┌─────────────┴─────────────┐
-17)│      RepartitionExec      │
-18)│    --------------------   │
-19)│  output_partition_count:  │
-20)│             1             │
-21)│                           │
-22)│    partitioning_scheme:   │
-23)│     RoundRobinBatch(4)    │
-24)└─────────────┬─────────────┘
-25)┌─────────────┴─────────────┐
-26)│     StreamingTableExec    │
-27)│    --------------------   │
-28)│       infinite: true      │
-29)│        limit: None        │
-30)└───────────────────────────┘
+09)│    --------------------   │
+10)│     target_batch_size:    │
+11)│            8192           │
+12)└─────────────┬─────────────┘
+13)┌─────────────┴─────────────┐
+14)│         FilterExec        │
+15)│    --------------------   │
+16)│         predicate:        │
+17)│        ticker@1 = A       │
+18)└─────────────┬─────────────┘
+19)┌─────────────┴─────────────┐
+20)│      RepartitionExec      │
+21)│    --------------------   │
+22)│  output_partition_count:  │
+23)│             1             │
+24)│                           │
+25)│    partitioning_scheme:   │
+26)│     RoundRobinBatch(4)    │
+27)└─────────────┬─────────────┘
+28)┌─────────────┴─────────────┐
+29)│     StreamingTableExec    │
+30)│    --------------------   │
+31)│       infinite: true      │
+32)│        limit: None        │
+33)└───────────────────────────┘
 
 
 # constant ticker, CAST(time AS DATE) = time, order by time
@@ -1402,29 +1462,32 @@ physical_plan
 05)└─────────────┬─────────────┘
 06)┌─────────────┴─────────────┐
 07)│    CoalesceBatchesExec    │
-08)└─────────────┬─────────────┘
-09)┌─────────────┴─────────────┐
-10)│         FilterExec        │
-11)│    --------------------   │
-12)│         predicate:        │
-13)│ ticker@1 = A AND CAST(time│
-14)│   @2 AS Date32) = date@0  │
-15)└─────────────┬─────────────┘
-16)┌─────────────┴─────────────┐
-17)│      RepartitionExec      │
-18)│    --------------------   │
-19)│  output_partition_count:  │
-20)│             1             │
-21)│                           │
-22)│    partitioning_scheme:   │
-23)│     RoundRobinBatch(4)    │
-24)└─────────────┬─────────────┘
-25)┌─────────────┴─────────────┐
-26)│     StreamingTableExec    │
-27)│    --------------------   │
-28)│       infinite: true      │
-29)│        limit: None        │
-30)└───────────────────────────┘
+08)│    --------------------   │
+09)│     target_batch_size:    │
+10)│            8192           │
+11)└─────────────┬─────────────┘
+12)┌─────────────┴─────────────┐
+13)│         FilterExec        │
+14)│    --------------------   │
+15)│         predicate:        │
+16)│ ticker@1 = A AND CAST(time│
+17)│   @2 AS Date32) = date@0  │
+18)└─────────────┬─────────────┘
+19)┌─────────────┴─────────────┐
+20)│      RepartitionExec      │
+21)│    --------------------   │
+22)│  output_partition_count:  │
+23)│             1             │
+24)│                           │
+25)│    partitioning_scheme:   │
+26)│     RoundRobinBatch(4)    │
+27)└─────────────┬─────────────┘
+28)┌─────────────┴─────────────┐
+29)│     StreamingTableExec    │
+30)│    --------------------   │
+31)│       infinite: true      │
+32)│        limit: None        │
+33)└───────────────────────────┘
 
 # same thing but order by date
 query TT
@@ -1440,29 +1503,32 @@ physical_plan
 05)└─────────────┬─────────────┘
 06)┌─────────────┴─────────────┐
 07)│    CoalesceBatchesExec    │
-08)└─────────────┬─────────────┘
-09)┌─────────────┴─────────────┐
-10)│         FilterExec        │
-11)│    --------------------   │
-12)│         predicate:        │
-13)│ ticker@1 = A AND CAST(time│
-14)│   @2 AS Date32) = date@0  │
-15)└─────────────┬─────────────┘
-16)┌─────────────┴─────────────┐
-17)│      RepartitionExec      │
-18)│    --------------------   │
-19)│  output_partition_count:  │
-20)│             1             │
-21)│                           │
-22)│    partitioning_scheme:   │
-23)│     RoundRobinBatch(4)    │
-24)└─────────────┬─────────────┘
-25)┌─────────────┴─────────────┐
-26)│     StreamingTableExec    │
-27)│    --------------------   │
-28)│       infinite: true      │
-29)│        limit: None        │
-30)└───────────────────────────┘
+08)│    --------------------   │
+09)│     target_batch_size:    │
+10)│            8192           │
+11)└─────────────┬─────────────┘
+12)┌─────────────┴─────────────┐
+13)│         FilterExec        │
+14)│    --------------------   │
+15)│         predicate:        │
+16)│ ticker@1 = A AND CAST(time│
+17)│   @2 AS Date32) = date@0  │
+18)└─────────────┬─────────────┘
+19)┌─────────────┴─────────────┐
+20)│      RepartitionExec      │
+21)│    --------------------   │
+22)│  output_partition_count:  │
+23)│             1             │
+24)│                           │
+25)│    partitioning_scheme:   │
+26)│     RoundRobinBatch(4)    │
+27)└─────────────┬─────────────┘
+28)┌─────────────┴─────────────┐
+29)│     StreamingTableExec    │
+30)│    --------------------   │
+31)│       infinite: true      │
+32)│        limit: None        │
+33)└───────────────────────────┘
 
 # same thing but order by ticker
 query TT
@@ -1476,46 +1542,9 @@ physical_plan
 03)└─────────────┬─────────────┘
 04)┌─────────────┴─────────────┐
 05)│    CoalesceBatchesExec    │
-06)└─────────────┬─────────────┘
-07)┌─────────────┴─────────────┐
-08)│         FilterExec        │
-09)│    --------------------   │
-10)│         predicate:        │
-11)│ ticker@1 = A AND CAST(time│
-12)│   @2 AS Date32) = date@0  │
-13)└─────────────┬─────────────┘
-14)┌─────────────┴─────────────┐
-15)│      RepartitionExec      │
-16)│    --------------------   │
-17)│  output_partition_count:  │
-18)│             1             │
-19)│                           │
-20)│    partitioning_scheme:   │
-21)│     RoundRobinBatch(4)    │
-22)└─────────────┬─────────────┘
-23)┌─────────────┴─────────────┐
-24)│     StreamingTableExec    │
-25)│    --------------------   │
-26)│       infinite: true      │
-27)│        limit: None        │
-28)└───────────────────────────┘
-
-
-# same thing but order by time, date
-query TT
-explain SELECT * FROM data 
-WHERE ticker = 'A' AND CAST(time AS DATE) = date
-ORDER BY "time", "date";
-----
-physical_plan
-01)┌───────────────────────────┐
-02)│  SortPreservingMergeExec  │
-03)│    --------------------   │
-04)│   time@2 ASC NULLS LAST,  │
-05)│    date@0 ASC NULLS LAST  │
-06)└─────────────┬─────────────┘
-07)┌─────────────┴─────────────┐
-08)│    CoalesceBatchesExec    │
+06)│    --------------------   │
+07)│     target_batch_size:    │
+08)│            8192           │
 09)└─────────────┬─────────────┘
 10)┌─────────────┴─────────────┐
 11)│         FilterExec        │
@@ -1541,6 +1570,49 @@ physical_plan
 31)└───────────────────────────┘
 
 
+# same thing but order by time, date
+query TT
+explain SELECT * FROM data 
+WHERE ticker = 'A' AND CAST(time AS DATE) = date
+ORDER BY "time", "date";
+----
+physical_plan
+01)┌───────────────────────────┐
+02)│  SortPreservingMergeExec  │
+03)│    --------------------   │
+04)│   time@2 ASC NULLS LAST,  │
+05)│    date@0 ASC NULLS LAST  │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│    CoalesceBatchesExec    │
+09)│    --------------------   │
+10)│     target_batch_size:    │
+11)│            8192           │
+12)└─────────────┬─────────────┘
+13)┌─────────────┴─────────────┐
+14)│         FilterExec        │
+15)│    --------------------   │
+16)│         predicate:        │
+17)│ ticker@1 = A AND CAST(time│
+18)│   @2 AS Date32) = date@0  │
+19)└─────────────┬─────────────┘
+20)┌─────────────┴─────────────┐
+21)│      RepartitionExec      │
+22)│    --------------------   │
+23)│  output_partition_count:  │
+24)│             1             │
+25)│                           │
+26)│    partitioning_scheme:   │
+27)│     RoundRobinBatch(4)    │
+28)└─────────────┬─────────────┘
+29)┌─────────────┴─────────────┐
+30)│     StreamingTableExec    │
+31)│    --------------------   │
+32)│       infinite: true      │
+33)│        limit: None        │
+34)└───────────────────────────┘
+
+
 
 
 # query
@@ -1558,28 +1630,31 @@ physical_plan
 06)└─────────────┬─────────────┘
 07)┌─────────────┴─────────────┐
 08)│    CoalesceBatchesExec    │
-09)└─────────────┬─────────────┘
-10)┌─────────────┴─────────────┐
-11)│         FilterExec        │
-12)│    --------------------   │
-13)│         predicate:        │
-14)│    date@0 = 2006-01-02    │
-15)└─────────────┬─────────────┘
-16)┌─────────────┴─────────────┐
-17)│      RepartitionExec      │
-18)│    --------------------   │
-19)│  output_partition_count:  │
-20)│             1             │
-21)│                           │
-22)│    partitioning_scheme:   │
-23)│     RoundRobinBatch(4)    │
-24)└─────────────┬─────────────┘
-25)┌─────────────┴─────────────┐
-26)│     StreamingTableExec    │
-27)│    --------------------   │
-28)│       infinite: true      │
-29)│        limit: None        │
-30)└───────────────────────────┘
+09)│    --------------------   │
+10)│     target_batch_size:    │
+11)│            8192           │
+12)└─────────────┬─────────────┘
+13)┌─────────────┴─────────────┐
+14)│         FilterExec        │
+15)│    --------------------   │
+16)│         predicate:        │
+17)│    date@0 = 2006-01-02    │
+18)└─────────────┬─────────────┘
+19)┌─────────────┴─────────────┐
+20)│      RepartitionExec      │
+21)│    --------------------   │
+22)│  output_partition_count:  │
+23)│             1             │
+24)│                           │
+25)│    partitioning_scheme:   │
+26)│     RoundRobinBatch(4)    │
+27)└─────────────┬─────────────┘
+28)┌─────────────┴─────────────┐
+29)│     StreamingTableExec    │
+30)│    --------------------   │
+31)│       infinite: true      │
+32)│        limit: None        │
+33)└───────────────────────────┘
 
 
 
@@ -1610,26 +1685,29 @@ physical_plan
 13)└───────────────────────────┘└─────────────┬─────────────┘
 14)-----------------------------┌─────────────┴─────────────┐
 15)-----------------------------│    CoalesceBatchesExec    │
-16)-----------------------------└─────────────┬─────────────┘
-17)-----------------------------┌─────────────┴─────────────┐
-18)-----------------------------│         FilterExec        │
-19)-----------------------------│    --------------------   │
-20)-----------------------------│    predicate: id@0 < 10   │
-21)-----------------------------└─────────────┬─────────────┘
-22)-----------------------------┌─────────────┴─────────────┐
-23)-----------------------------│      RepartitionExec      │
-24)-----------------------------│    --------------------   │
-25)-----------------------------│  output_partition_count:  │
-26)-----------------------------│             1             │
-27)-----------------------------│                           │
-28)-----------------------------│    partitioning_scheme:   │
-29)-----------------------------│     RoundRobinBatch(4)    │
-30)-----------------------------└─────────────┬─────────────┘
-31)-----------------------------┌─────────────┴─────────────┐
-32)-----------------------------│       WorkTableExec       │
-33)-----------------------------│    --------------------   │
-34)-----------------------------│        name: nodes        │
-35)-----------------------------└───────────────────────────┘
+16)-----------------------------│    --------------------   │
+17)-----------------------------│     target_batch_size:    │
+18)-----------------------------│            8192           │
+19)-----------------------------└─────────────┬─────────────┘
+20)-----------------------------┌─────────────┴─────────────┐
+21)-----------------------------│         FilterExec        │
+22)-----------------------------│    --------------------   │
+23)-----------------------------│    predicate: id@0 < 10   │
+24)-----------------------------└─────────────┬─────────────┘
+25)-----------------------------┌─────────────┴─────────────┐
+26)-----------------------------│      RepartitionExec      │
+27)-----------------------------│    --------------------   │
+28)-----------------------------│  output_partition_count:  │
+29)-----------------------------│             1             │
+30)-----------------------------│                           │
+31)-----------------------------│    partitioning_scheme:   │
+32)-----------------------------│     RoundRobinBatch(4)    │
+33)-----------------------------└─────────────┬─────────────┘
+34)-----------------------------┌─────────────┴─────────────┐
+35)-----------------------------│       WorkTableExec       │
+36)-----------------------------│    --------------------   │
+37)-----------------------------│        name: nodes        │
+38)-----------------------------└───────────────────────────┘
 
 query TT
 explain COPY (VALUES (1, 'foo', 1, '2023-01-01'), (2, 'bar', 2, '2023-01-02'), 
(3, 'baz', 3, '2023-01-03'))
@@ -1647,6 +1725,74 @@ physical_plan
 09)│          rows: 1          │
 10)└───────────────────────────┘
 
+# Test explain tree rendering for CoalesceBatchesExec with limit
+statement ok
+CREATE TABLE IF NOT EXISTS t1 (a INT) AS 
VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+query TT
+EXPLAIN SELECT COUNT(*) FROM (SELECT a FROM t1 WHERE a > 3 LIMIT 3 OFFSET 6);
+----
+physical_plan
+01)┌───────────────────────────┐
+02)│       ProjectionExec      │
+03)│    --------------------   │
+04)│         count(*):         │
+05)│     count(Int64(1))@0     │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│       AggregateExec       │
+09)│    --------------------   │
+10)│   aggr: count(Int64(1))   │
+11)│        mode: Final        │
+12)└─────────────┬─────────────┘
+13)┌─────────────┴─────────────┐
+14)│   CoalescePartitionsExec  │
+15)└─────────────┬─────────────┘
+16)┌─────────────┴─────────────┐
+17)│       AggregateExec       │
+18)│    --------------------   │
+19)│   aggr: count(Int64(1))   │
+20)│       mode: Partial       │
+21)└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐
+23)│      RepartitionExec      │
+24)│    --------------------   │
+25)│  output_partition_count:  │
+26)│             1             │
+27)│                           │
+28)│    partitioning_scheme:   │
+29)│     RoundRobinBatch(4)    │
+30)└─────────────┬─────────────┘
+31)┌─────────────┴─────────────┐
+32)│       ProjectionExec      │
+33)└─────────────┬─────────────┘
+34)┌─────────────┴─────────────┐
+35)│      GlobalLimitExec      │
+36)│    --------------------   │
+37)│          limit: 3         │
+38)│          skip: 6          │
+39)└─────────────┬─────────────┘
+40)┌─────────────┴─────────────┐
+41)│    CoalesceBatchesExec    │
+42)│    --------------------   │
+43)│          limit: 9         │
+44)│                           │
+45)│     target_batch_size:    │
+46)│            8192           │
+47)└─────────────┬─────────────┘
+48)┌─────────────┴─────────────┐
+49)│         FilterExec        │
+50)│    --------------------   │
+51)│     predicate: a@0 > 3    │
+52)└─────────────┬─────────────┘
+53)┌─────────────┴─────────────┐
+54)│       DataSourceExec      │
+55)│    --------------------   │
+56)│         bytes: 160        │
+57)│       format: memory      │
+58)│          rows: 1          │
+59)└───────────────────────────┘
+
 # Test explain tree for LazyMemoryExec
 query TT
 EXPLAIN SELECT * FROM generate_series(1, 100)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to