Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
1.19.0
-
None
-
None
Description
When running a union all query that has right side operators like join or aggregate, and limit on top of the union, such query will fail for the case when right input shouldn't read because the left one had required number of records for limit.
Example of such failing query (thanks to James Turton for helping to minimize it):
WITH foo AS (SELECT 1 AS a FROM cp.`/tpch/nation.parquet` UNION ALL SELECT 1 AS a FROM cp.`/tpch/nation.parquet` WHERE n_nationkey > (SELECT 1) ) SELECT * FROM foo LIMIT 1