mirror of
https://github.com/apache/impala.git
synced 2025-12-30 12:02:10 -05:00
Fixes two issues that can occur when generating the plan for a
stmt with an empty result set (e.g. due to limit 0 or constant
predicates that evaluate to false):
1) Unions with an inline view that produces an empty result set
does not create the EmptySetNode for the correct stmt.
2) An EmptySetNode may contain non-materialized tuples which
will fail a precondition check when generating the thrift
plan.
Change-Id: I1511c755be3a59fdb8934624fd08250323266d27
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4744
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
101 lines
1.8 KiB
Plaintext
101 lines
1.8 KiB
Plaintext
====
|
|
---- QUERY
|
|
# testtbl is empty
|
|
select * from testtbl
|
|
---- TYPES
|
|
bigint, string, int
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
# month ends at 12
|
|
select int_col from alltypessmall where month > 100
|
|
---- TYPES
|
|
int
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
# Empty partitioned table test
|
|
select field from emptytable
|
|
---- TYPES
|
|
string
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
# Constant conjunct.
|
|
select t1.id, t2.id
|
|
from functional.alltypestiny t1
|
|
left outer join functional.alltypes t2
|
|
on t1.id = t2.id
|
|
where false
|
|
---- TYPES
|
|
int, int
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
# Constant conjunct in query block with an aggregation.
|
|
select count(int_col), avg(double_col), count(*)
|
|
from functional.alltypes
|
|
where null
|
|
---- TYPES
|
|
bigint, double, bigint
|
|
---- RESULTS
|
|
0,NULL,0
|
|
====
|
|
---- QUERY
|
|
# Constant conjunct in inline view.
|
|
select e.id, f.id
|
|
from functional.alltypessmall f
|
|
inner join
|
|
(select t1.id
|
|
from functional.alltypestiny t1
|
|
left outer join functional.alltypes t2
|
|
on t1.id = t2.id
|
|
where 1 + 3 > 10) e
|
|
on e.id = f.id
|
|
---- TYPES
|
|
int, int
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
# Limit 0
|
|
select t1.id, t2.id
|
|
from functional.alltypestiny t1
|
|
left outer join functional.alltypes t2
|
|
on t1.id = t2.id
|
|
limit 0
|
|
---- TYPES
|
|
int, int
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
# Limit 0 in query block with an aggregation
|
|
select count(int_col), avg(double_col), count(*)
|
|
from functional.alltypes
|
|
limit 0
|
|
---- TYPES
|
|
bigint, double, bigint
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
# Limit 0 in inline view
|
|
select e.id, f.id
|
|
from functional.alltypessmall f
|
|
inner join
|
|
(select t1.id
|
|
from functional.alltypestiny t1
|
|
left outer join functional.alltypes t2
|
|
on t1.id = t2.id
|
|
limit 0) e
|
|
on e.id = f.id
|
|
---- TYPES
|
|
int, int
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
# IMPALA-1234: Analytic with constant empty result set failed precondition check in FE
|
|
select MIN(int_col) OVER () FROM alltypes limit 0
|
|
---- RESULTS
|
|
---- TYPES
|
|
INT
|
|
====
|