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

Predicate in the ORDER BY clause causes failure with cnf rewrite enabled

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Impala 4.0.0
    • Impala 4.0.0
    • Frontend
    • None
    • ghx-label-1

    Description

      When enable_cnf_rewrites is set to true, following query which has a predicate in the ORDER BY clause encounters failure. This is very similar to IMPALA-9620 except the predicate occurs in the ORDER BY.

      set enable_cnf_rewrites = true;
      
      select l_quantity, if(l_quantity < 5 or l_quantity > 45, 'invalid', 'valid') 
        from lineitem 
      order by l_quantity, if(l_quantity < 5 or l_quantity > 45, 'invalid', 'valid')
       limit 5
      
      ERROR: IllegalStateException: null
      

      Stack trace:

       java.lang.IllegalStateException
              at com.google.common.base.Preconditions.checkState(Preconditions.java:492)
              at org.apache.impala.analysis.SlotRef.getIdsHelper(SlotRef.java:229)
              at org.apache.impala.analysis.Expr.getIdsHelper(Expr.java:1286)
              at org.apache.impala.analysis.Expr.getIdsHelper(Expr.java:1286)
              at org.apache.impala.analysis.Expr.getIds(Expr.java:1279)
              at org.apache.impala.rewrite.ConvertToCNFRule.convertToCNF(ConvertToCNFRule.java:111)
              at org.apache.impala.rewrite.ConvertToCNFRule.apply(ConvertToCNFRule.java:86)
              at org.apache.impala.rewrite.ExprRewriter.applyRuleBottomUp(ExprRewriter.java:85)
              at org.apache.impala.rewrite.ExprRewriter.applyRuleBottomUp(ExprRewriter.java:83)
              at org.apache.impala.rewrite.ExprRewriter.applyRuleRepeatedly(ExprRewriter.java:71)
              at org.apache.impala.rewrite.ExprRewriter.rewrite(ExprRewriter.java:55)
              at org.apache.impala.analysis.SelectStmt.rewriteCheckOrdinalResult(SelectStmt.java:1043)
              at org.apache.impala.analysis.SelectStmt.rewriteExprs(SelectStmt.java:1068)
              at org.apache.impala.analysis.AnalysisContext.analyze(AnalysisContext.java:472)
              at org.apache.impala.analysis.AnalysisContext.analyzeAndAuthorize(AnalysisContext.java:415)
              at org.apache.impala.service.Frontend.doCreateExecRequest(Frontend.java:1530)
              at org.apache.impala.service.Frontend.getTExecRequest(Frontend.java:1497)
      

      Attachments

        Issue Links

          Activity

            People

              amansinha Aman Sinha
              amansinha Aman Sinha
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: