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

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

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • Impala 2.8.0
    • Impala 2.8.0
    • Frontend

    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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment