Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrishn7 committed Feb 9, 2025
1 parent 23f2bb4 commit d343662
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions datafusion/sqllogictest/test_files/union_by_name.slt
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,66 @@ SELECT t1.x FROM t1 UNION BY NAME SELECT x FROM t1 ORDER BY t1.x;
1
3

query I
SELECT t1.x FROM t1 UNION ALL BY NAME SELECT x FROM t1 ORDER BY t1.x;
----
1
1
3
3
3
3

query I
SELECT x FROM t1 UNION BY NAME SELECT x FROM t1 ORDER BY t1.x;
----
1
3

query I
SELECT x FROM t1 UNION ALL BY NAME SELECT x FROM t1 ORDER BY t1.x;
----
1
1
3
3
3
3

query II
(SELECT x FROM t1 UNION ALL SELECT x FROM t1) UNION BY NAME SELECT 5 ORDER BY x;
----
NULL 1
NULL 3
5 NULL

# TODO: This should pass, but the sanity checker isn't allowing it.
# Commenting out the ordering check in the sanity checker produces the correct result.
query error
(SELECT x FROM t1 UNION ALL SELECT x FROM t1) UNION ALL BY NAME SELECT 5 ORDER BY x;
----
DataFusion error: SanityCheckPlan
caused by
Error during planning: Plan: ["SortPreservingMergeExec: [x@1 ASC NULLS LAST]", " UnionExec", " SortExec: expr=[x@1 ASC NULLS LAST], preserve_partitioning=[true]", " ProjectionExec: expr=[NULL as Int64(5), x@0 as x]", " UnionExec", " MemoryExec: partitions=1, partition_sizes=[1]", " MemoryExec: partitions=1, partition_sizes=[1]", " ProjectionExec: expr=[5 as Int64(5), NULL as x]", " PlaceholderRowExec"] does not satisfy order requirements: [x@1 ASC NULLS LAST]. Child-0 order: []


query II
(SELECT x FROM t1 UNION ALL SELECT y FROM t1) UNION BY NAME SELECT 5 ORDER BY x;
----
NULL 1
NULL 3
5 NULL

# TODO: This should pass, but the sanity checker isn't allowing it.
# Commenting out the ordering check in the sanity checker produces the correct result.
query error
(SELECT x FROM t1 UNION ALL SELECT y FROM t1) UNION ALL BY NAME SELECT 5 ORDER BY x;
----
DataFusion error: SanityCheckPlan
caused by
Error during planning: Plan: ["SortPreservingMergeExec: [x@1 ASC NULLS LAST]", " UnionExec", " SortExec: expr=[x@1 ASC NULLS LAST], preserve_partitioning=[true]", " ProjectionExec: expr=[NULL as Int64(5), x@0 as x]", " UnionExec", " MemoryExec: partitions=1, partition_sizes=[1]", " ProjectionExec: expr=[y@0 as x]", " MemoryExec: partitions=1, partition_sizes=[1]", " ProjectionExec: expr=[5 as Int64(5), NULL as x]", " PlaceholderRowExec"] does not satisfy order requirements: [x@1 ASC NULLS LAST]. Child-0 order: []



# Ambiguous name

Expand Down

0 comments on commit d343662

Please sign in to comment.