alamb commented on code in PR #15066:
URL: https://github.com/apache/datafusion/pull/15066#discussion_r1985457619


##########
datafusion/physical-plan/src/sorts/partial_sort.rs:
##########
@@ -227,8 +227,18 @@ impl DisplayAs for PartialSortExec {
                 }
             }
             DisplayFormatType::TreeRender => {
-                // TODO: collect info
-                write!(f, "")
+                let common_prefix_length = self.common_prefix_length;
+                match self.fetch {

Review Comment:
   I recommend we make this simpler -- specifically the common_prefix_length is 
too detailed for the TreeRender  per 
https://github.com/apache/datafusion/blob/24586938518d747c16dd0702454fb334ab426a85/datafusion/physical-plan/src/display.rs#L48-L75
   
   I also think the TopK / Fetch thing is confusing
   
   What I would recommend is:
   
   ```
   01)┌───────────────────────────┐
   02)│      PartialSortExec      │
   03)│    --------------------   │
   07)│           sort:           │
   08)│[a@1 ASC NULLS LAST, b@2...│
   09)└─────────────┬─────────────┘
   10)┌─────────────┴─────────────┐
   11)│     StreamingTableExec    │
   12)└───────────────────────────┘
   ```
   
   And
   ```
   01)┌───────────────────────────┐
   02)│      PartialSortExec      │
   03)│    --------------------   │
   04)│       fetch=50      │
   09)│           sort:           │
   10)│[a@1 ASC NULLS LAST, b@2...│
   11)└─────────────┬─────────────┘
   ```
   
   Here is what duckdb does for refernece:
   
   ```sql
   D create table foo (x int);
   D insert into foo values (1);
   D explain select * from foo order by x;
   
   ┌─────────────────────────────┐
   │┌───────────────────────────┐│
   ││       Physical Plan       ││
   │└───────────────────────────┘│
   └─────────────────────────────┘
   ┌───────────────────────────┐
   │         PROJECTION        │
   │    ────────────────────   │
   │__internal_decompress_integ│
   │     ral_integer(#0, 1)    │
   │                           │
   │          ~1 Rows          │
   └─────────────┬─────────────┘
   ┌─────────────┴─────────────┐
   │          ORDER_BY         │
   │    ────────────────────   │
   │   memory.main.foo.x ASC   │
   └─────────────┬─────────────┘
   ┌─────────────┴─────────────┐
   │         PROJECTION        │
   │    ────────────────────   │
   │__internal_compress_integra│
   │     l_utinyint(#0, 1)     │
   │                           │
   │          ~1 Rows          │
   └─────────────┬─────────────┘
   ┌─────────────┴─────────────┐
   │         SEQ_SCAN          │
   │    ────────────────────   │
   │         Table: foo        │
   │   Type: Sequential Scan   │
   │       Projections: x      │
   │                           │
   │          ~1 Rows          │
   └───────────────────────────┘
   ```



-- 
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: github-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to