Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
Impala 2.8.0
Description
When folding constant expressions Impala may incorrectly replace a constant boolean expression with NULL instead of FALSE. This may lead to incorrect results.
Repro:
explain select * from functional_kudu.alltypes where bool_col = (true and false); +------------------------------------------------------------------------------------+ | Explain String | +------------------------------------------------------------------------------------+ | Estimated Per-Host Requirements: Memory=0B VCores=1 | | WARNING: The following tables are missing relevant table and/or column statistics. | | functional_kudu.alltypes | | | | PLAN-ROOT SINK | | | | | 01:EXCHANGE [UNPARTITIONED] | | | | | 00:SCAN KUDU [functional_kudu.alltypes] | | predicates: bool_col = NULL <--- Should be FALSE | +------------------------------------------------------------------------------------+
The underlying issue is a simple one. We are not calling the correct isSet() function on a thrift struct. See LiteralExpr.create():
... case BOOLEAN: if (val.isBool_val()) result = new BoolLiteral(val.bool_val); break; ...
The check should be: val.isSetBool_val()