@@ -835,6 +835,7 @@ explain
835835with selection as (
836836 select *
837837 from test_limit_with_partitions
838+ order by part_key
838839 limit 1
839840)
840841select 1 as foo
@@ -847,19 +848,19 @@ logical_plan
84784802)--Sort: selection.part_key ASC NULLS LAST, fetch=1000
84884903)----Projection: Int64(1) AS foo, selection.part_key
84985004)------SubqueryAlias: selection
850- 05)--------Limit: skip=0 , fetch=1
851- 06)----------TableScan: test_limit_with_partitions projection=[part_key], fetch=1
851+ 05)--------Sort: test_limit_with_partitions.part_key ASC NULLS LAST , fetch=1
852+ 06)----------TableScan: test_limit_with_partitions projection=[part_key]
852853physical_plan
853- 01)ProjectionExec: expr=[foo@0 as foo]
854- 02)--SortExec: TopK(fetch=1000), expr=[part_key@1 ASC NULLS LAST], preserve_partitioning=[false]
855- 03)----ProjectionExec: expr=[1 as foo, part_key@0 as part_key]
856- 04)------CoalescePartitionsExec: fetch=1
857- 05)--------DataSourceExec: file_groups={3 groups: [[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/parquet/test_limit_with_partitions/part-0.parquet:0..794], [WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/parquet/test_limit_with_partitions/part-1.parquet:0..794], [WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/parquet/test_limit_with_partitions/part-2.parquet:0..794]]}, projection=[part_key], limit=1, file_type=parquet
854+ 01)ProjectionExec: expr=[1 as foo]
855+ 02)--SortPreservingMergeExec: [part_key@0 ASC NULLS LAST], fetch=1
856+ 03)----SortExec: TopK(fetch=1), expr=[part_key@0 ASC NULLS LAST], preserve_partitioning=[true]
857+ 04)------DataSourceExec: file_groups={3 groups: [[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/parquet/test_limit_with_partitions/part-0.parquet:0..794], [WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/parquet/test_limit_with_partitions/part-1.parquet:0..794], [WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/parquet/test_limit_with_partitions/part-2.parquet:0..794]]}, projection=[part_key], file_type=parquet
858858
859859query I
860860with selection as (
861861 select *
862862 from test_limit_with_partitions
863+ order by part_key
863864 limit 1
864865)
865866select 1 as foo
0 commit comments