Hi,

I'm investigating the issue of IMPALA-3678, and wanted to work on it. Some 
findings as follow:

[TEST SQL]:
select xx.o_orderkey from (
(select o_orderkey from orders x order by o_orderkey desc limit 15)
union
(select o_orderkey from tpch_parquet.orders_pq x order by o_orderkey desc limit 
15)) xx
left join lineitem l
on xx.o_orderkey = l.l_orderkey where xx.o_orderkey > 0

This bug appears in the phrase of creating the plan tree. More precisely, while 
creating UNION node,
the predicate(xx.o_orderkey > 0), owned by LEFT JOIN clause, will be propagated 
to UNION clause,
at the same time, a cloned predicate will be added into the global conjuncts. 
Then, on line SortNode.java:92,
assignConjuncts(analyzer) could match the new predicate and add it to 
conjuncts_, obviously, the next statement
Preconditions.checkState(conjuncts_.isEmpty()) fails.

My rough idea to fix it is, add LEFT JOIN predicates into 
globalState_.ojClauseByConjunct, or do some other tricks in
assignConjuncts(analyzer).

Would anyone help clarify if it's not going in the right way?
Thanks.

Reply via email to