alamb commented on issue #12446:
URL: https://github.com/apache/datafusion/issues/12446#issuecomment-2361896831
Even simpler:
```sql
select * from (select c, a, NULL::int as a0 from t order by a, c) t1
union all
select * from (select c, NULL::int as a, a0 from t order by a0, c) t2
order by a, a0, c
limit 2;
```
> DataFusion error: SanityCheckPlan
caused by
Error during planning: Plan: ["SortPreservingMergeExec: [a@1 ASC NULLS
LAST,a0@2 ASC NULLS LAST,c@0 ASC NULLS LAST], fetch=2", " UnionExec", "
SortExec: TopK(fetch=2), expr=[a@1 ASC NULLS LAST,c@0 ASC NULLS LAST],
preserve_partitioning=[false]", " ProjectionExec: expr=[c@1 as c, a@0 as
a, NULL as a0]", " MemoryExec: partitions=1, partition_sizes=[1]", "
SortExec: TopK(fetch=2), expr=[a0@2 ASC NULLS LAST,c@0 ASC NULLS LAST],
preserve_partitioning=[false]", " ProjectionExec: expr=[c@1 as c, NULL as
a, a0@0 as a0]", " MemoryExec: partitions=1, partition_sizes=[1]"] does
not satisfy order requirements: [PhysicalSortRequirement { expr: Column { name:
"a", index: 1 }, options: Some(SortOptions { descending: false, nulls_first:
false }) }, PhysicalSortRequirement { expr: Column { name: "a0", index: 2 },
options: Some(SortOptions { descending: false, nulls_first: false }) },
PhysicalSortRequirement { expr: Column { name: "c", index: 0 }, options:
Some(SortOp
tions { descending: false, nulls_first: false }) }]. Child-0 order:
OrderingEquivalenceClass { orderings: [[PhysicalSortExpr { expr: Column { name:
"a", index: 1 }, options: SortOptions { descending: false, nulls_first: false }
}], [PhysicalSortExpr { expr: Column { name: "a0", index: 2 }, options:
SortOptions { descending: false, nulls_first: false } }]] }
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]