Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-2974

SELECT COUNT(DISTINCT c1, c2,...) throws NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      See discussion on PHOENIX-2965.

      Phoenix throws an NPE for a query like this: SELECT COUNT(DISINCT p1, p2) FROM table

      java.lang.NullPointerException
      	at org.apache.phoenix.parse.FunctionParseNode.validate(FunctionParseNode.java:136)
      	at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:325)
      	at org.apache.phoenix.compile.ProjectionCompiler$SelectClauseVisitor.visitLeave(ProjectionCompiler.java:680)
      	at org.apache.phoenix.compile.ProjectionCompiler$SelectClauseVisitor.visitLeave(ProjectionCompiler.java:576)
      	at org.apache.phoenix.parse.FunctionParseNode.accept(FunctionParseNode.java:86)
      	at org.apache.phoenix.compile.ProjectionCompiler.compile(ProjectionCompiler.java:408)
      	at org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:564)
      	at org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
      	at org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:205)
      	at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:157)
      

      While not it's not standard and many DBs do not support this, I think we can discuss supporting this, or at the very least not throw an NPE.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              larsh Lars Hofhansl
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: