You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Will Yu (JIRA)" <ji...@apache.org> on 2019/04/15 23:42:00 UTC

[jira] [Created] (CALCITE-3003) AssertionError when GROUP BY nested field

Will Yu created CALCITE-3003:
--------------------------------

             Summary: AssertionError when GROUP BY nested field
                 Key: CALCITE-3003
                 URL: https://issues.apache.org/jira/browse/CALCITE-3003
             Project: Calcite
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.19.0
            Reporter: Will Yu


Calcite will throw AssertionError when GROUP BY nested field
{code:java}
@Test
public void test() {
final String sql = "select coord.x, avg(coord.y) from customer.contact_peek GROUP BY coord.x";
sql(sql).ok();
}{code}
 

The stacktrace is 
{code:java}
java.lang.AssertionError
at org.apache.calcite.sql.validate.SqlValidatorUtil.analyzeGroupExpr(SqlValidatorUtil.java:839)
at org.apache.calcite.sql.validate.SqlValidatorUtil.convertGroupSet(SqlValidatorUtil.java:791)
at org.apache.calcite.sql.validate.SqlValidatorUtil.analyzeGroupItem(SqlValidatorUtil.java:748)
at org.apache.calcite.sql.validate.AggregatingSelectScope.resolve(AggregatingSelectScope.java:104)
at org.apache.calcite.sql.validate.AggregatingSelectScope.lambda$new$0(AggregatingSelectScope.java:65)
at com.google.common.base.Suppliers$MemoizingSupplier.get(Suppliers.java:131)
at org.apache.calcite.sql.validate.AggregatingSelectScope.nullifyType(AggregatingSelectScope.java:178)
at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1680)
at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1664)
at org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:467)
at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:4112)
at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3375)
at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60)
at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:996)
at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:956)
at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:216)
at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:931)
at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:638)
at org.apache.calcite.test.SqlToRelTestBase$TesterImpl.convertSqlToRel(SqlToRelTestBase.java:608)
at org.apache.calcite.test.SqlToRelTestBase$TesterImpl.assertConvertsTo(SqlToRelTestBase.java:723)
at org.apache.calcite.test.SqlToRelConverterTest$Sql.convertsTo(SqlToRelConverterTest.java:3301)
at org.apache.calcite.test.SqlToRelConverterTest$Sql.ok(SqlToRelConverterTest.java:3293)
at org.apache.calcite.test.SqlToRelConverterTest.test(SqlToRelConverterTest.java:2680){code}

The root cause is obvious and fix is just to remove the assertion line. Question is given that GROUP BY item should be validated beforehand, can we just delete this assertion?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)