Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-4479

Evaluation of a constant boolean expr results in a NULL instead of FALSE.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: Impala 2.8.0
    • Fix Version/s: Impala 2.8.0
    • Component/s: Frontend
    • Labels:

      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()

        Attachments

          Activity

            People

            • Assignee:
              alex.behm Alexander Behm
              Reporter:
              alex.behm Alexander Behm
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: