Dmitry Lychagin created ASTERIXDB-2934:
------------------------------------------

             Summary: Query fails with internal error 
                 Key: ASTERIXDB-2934
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2934
             Project: Apache AsterixDB
          Issue Type: Bug
          Components: COMP - Compiler
    Affects Versions: 0.9.6
            Reporter: Dmitry Lychagin
            Assignee: Dmitry Lychagin
             Fix For: 0.9.7


The following query fails with NullPointerException at compile time.
{noformat}
SELECT x, y, COUNT(*) AS cnt
GROUP BY ROLLUP(x, y);
{noformat}
Exception
{noformat}
java.lang.NullPointerException: Cannot invoke "java.util.List.size()" because 
"fieldList" is null
        at 
org.apache.asterix.lang.sqlpp.visitor.DeepCopyVisitor.copyFieldList(DeepCopyVisitor.java:560)
 ~[classes/:?]
        at 
org.apache.asterix.lang.sqlpp.visitor.DeepCopyVisitor.visit(DeepCopyVisitor.java:319)
 ~[classes/:?]
        at 
org.apache.asterix.lang.sqlpp.visitor.DeepCopyVisitor.visit(DeepCopyVisitor.java:76)
 ~[classes/:?]
        at 
org.apache.asterix.lang.common.clause.GroupbyClause.accept(GroupbyClause.java:109)
 ~[classes/:?]
        at 
org.apache.asterix.lang.sqlpp.visitor.DeepCopyVisitor.visit(DeepCopyVisitor.java:171)
 ~[classes/:?]
        at 
org.apache.asterix.lang.sqlpp.visitor.DeepCopyVisitor.visit(DeepCopyVisitor.java:76)
 ~[classes/:?]
        at 
org.apache.asterix.lang.sqlpp.clause.SelectBlock.accept(SelectBlock.java:55) 
~[classes/:?]
        at 
org.apache.asterix.lang.sqlpp.util.SqlppRewriteUtil.deepCopy(SqlppRewriteUtil.java:60)
 ~[classes/:?]
        at 
org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppGroupingSetsVisitor.rewriteMultipleGroupingSets(SqlppGroupingSetsVisitor.java:338)
 ~[classes/:?]
{noformat}

This query has SELECT clause with GROUP BY clause, but without FROM clause.
This combination should not be allowed. If GROUP BY clause is present then FROM 
clause should be required. If FROM clause is absent then the only allowed 
clauses should be SELECT, LET and WHERE. i.e. SELECT ... LET ... WHERE ...



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to