Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Impala 3.4.0
-
None
-
ghx-label-10
Description
The selectivity for BooleanLiterals is not current set. In most cases predicates containing boolean literals are either rare or optimized away. However certain statement rewrites will insert boolean literals when modifying or removed a predicate that is no longer relevant, with more complex predicates and in particular disjunctive predicates these boolean literals can't be optimized away.
Simply a true literal should have selectivity of 1 and false of 0.
For example the cardinality below should in fact be closer to 7,300 instead of assuming the default selectivity of 0.1 hence 730.
Query: explain select id from alltypes where int_col != 1 or true +-------------------------------------------------------------+ | Explain String | +-------------------------------------------------------------+ | Max Per-Host Resource Reservation: Memory=32.00KB Threads=3 | | Per-Host Resource Estimates: Memory=160MB | | Codegen disabled by planner | | | | PLAN-ROOT SINK | | | | | 01:EXCHANGE [UNPARTITIONED] | | | | | 00:SCAN HDFS [functional.alltypes] | | HDFS partitions=24/24 files=24 size=478.45KB | | predicates: TRUE OR int_col != 1 | | row-size=8B cardinality=730 | +-------------------------------------------------------------+