rkrishn7 commented on code in PR #14538: URL: https://github.com/apache/datafusion/pull/14538#discussion_r1948419349
########## datafusion/sqllogictest/test_files/union_by_name.slt: ########## @@ -0,0 +1,264 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +statement ok +CREATE TABLE t1 (x INT, y INT); + +statement ok +INSERT INTO t1 VALUES (3, 3), (3, 3), (1, 1); + +statement ok +CREATE TABLE t2 (y INT, z INT); + +statement ok +INSERT INTO t2 VALUES (2, 2), (4, 4); + + +# Test binding +query I +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. Review Comment: A few of the `UNION ALL BY NAME` tests are failing during the sanity checker. Not completely sure why atm 🤔 -- 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