File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed
core/src/physical_optimizer Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ use datafusion_physical_plan::joins::SymmetricHashJoinExec;
34
34
use datafusion_physical_plan:: { get_plan_string, ExecutionPlanProperties } ;
35
35
36
36
use datafusion_physical_optimizer:: PhysicalOptimizerRule ;
37
+ use datafusion_physical_plan:: sorts:: sort:: SortExec ;
38
+ use datafusion_physical_plan:: union:: UnionExec ;
37
39
use itertools:: izip;
38
40
39
41
/// The SanityCheckPlan rule rejects the following query plans:
@@ -125,6 +127,14 @@ pub fn check_plan_sanity(
125
127
plan. required_input_ordering( ) . iter( ) ,
126
128
plan. required_input_distribution( ) . iter( )
127
129
) {
130
+ // TEMP HACK WORKAROUND https://github.com/apache/datafusion/issues/11492
131
+ if child. as_any ( ) . downcast_ref :: < UnionExec > ( ) . is_some ( ) {
132
+ continue ;
133
+ }
134
+ if child. as_any ( ) . downcast_ref :: < SortExec > ( ) . is_some ( ) {
135
+ continue ;
136
+ }
137
+
128
138
let child_eq_props = child. equivalence_properties ( ) ;
129
139
if let Some ( child_sort_req) = child_sort_req {
130
140
if !child_eq_props. ordering_satisfy_requirement ( child_sort_req) {
Original file line number Diff line number Diff line change @@ -464,6 +464,9 @@ physical_plan
464
464
# Clean up after the test
465
465
########
466
466
467
+ statement ok
468
+ drop table t
469
+
467
470
statement ok
468
471
drop table t1;
469
472
@@ -647,3 +650,36 @@ DROP TABLE t1;
647
650
648
651
statement ok
649
652
DROP TABLE t2;
653
+ ###
654
+ # Test for https://github.com/apache/datafusion/issues/11492
655
+ ###
656
+
657
+ # Input data is
658
+ # a,b,c
659
+ # 1,2,3
660
+
661
+ statement ok
662
+ CREATE EXTERNAL TABLE t (
663
+ a INT,
664
+ b INT,
665
+ c INT
666
+ )
667
+ STORED AS CSV
668
+ LOCATION '../core/tests/data/example.csv'
669
+ WITH ORDER (a ASC)
670
+ OPTIONS ('format.has_header' 'true');
671
+
672
+ query T
673
+ SELECT (SELECT a from t ORDER BY a) UNION ALL (SELECT 'bar' as a from t) ORDER BY a;
674
+ ----
675
+ 1
676
+ bar
677
+
678
+ query I
679
+ SELECT (SELECT a from t ORDER BY a) UNION ALL (SELECT NULL as a from t) ORDER BY a;
680
+ ----
681
+ 1
682
+ NULL
683
+
684
+ statement ok
685
+ drop table t
You can’t perform that action at this time.
0 commit comments