Details
-
Bug
-
Status: Resolved
-
Critical
-
Resolution: Fixed
-
Impala 4.3.0
-
None
-
ghx-label-10
Description
IMPALA-12164 skipped registering conjuncts that the analyzer expects to remove because an earlier conjunct evaluates to constant False. However some ExprRewriteRules don't analyze the predicates they produce, which can lead to those conjuncts not actually being removed until a reAnalyze phase.
reAnalyze uses a new Analyzer (with new GlobalState); it restarts counting Expr IDs from 0. That can lead to re-using the same Expr ID and marking it as assigned. Then when a new Expr gets the same ID, it will skip materializing slots, which can cause problems later (like if that Expr is part of a hash join).
Some example queries:
1. still a problem
WITH v AS (SELECT 1 FROM functional.alltypestiny t1 JOIN functional.alltypestiny t2 ON t1.id = t2.id) SELECT 1 FROM functional.alltypestiny t1 WHERE ((t1.id = 1 and false) or (t1.id = 1 and false)) AND t1.id = 1 AND t1.id = 1 UNION ALL SELECT 1 FROM functional.alltypestiny t1 WHERE ((t1.id = 1 and false) or (t1.id = 1 and false)) AND t1.id = 1 AND t1.id = 1 UNION ALL SELECT 1 FROM v UNION ALL SELECT 1 FROM v;
2. already fixed via IMPALA-13203
WITH v as (SELECT 1 FROM functional.alltypes t1 JOIN functional.alltypes t2 ON t1.id = t2.id) SELECT 1 FROM functional.alltypes t1 WHERE t1.id = 1 AND t1.id = 1 AND t1.id = 1 AND false UNION ALL SELECT 1 FROM functional.alltypes t1 WHERE t1.id = 1 AND false UNION ALL SELECT 1 FROM v UNION ALL SELECT 1 FROM v;
Attachments
Issue Links
- is caused by
-
IMPALA-12164 The query fails with "IllegalStateException: Illegal reference to non-materialized slot: tid=x sid=x"
- Resolved
- is related to
-
IMPALA-13360 Set type of assignedConjuncts should be consistent
- Open
-
IMPALA-8030 Remove duplicate in-clause values for selectivity calcs
- Open
- relates to
-
IMPALA-13203 ExprRewriter did not rewrite 'id = 0 OR false' as expected
- Resolved
-
IMPALA-13344 Impala rewrites may be incomplete
- Resolved
- Testing discovered
-
IMPALA-13365 markConjunctAssigned called on conjuncts that aren't registered
- Open