You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Chunwei Lei (JIRA)" <ji...@apache.org> on 2019/05/05 03:23:00 UTC

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

    [ https://issues.apache.org/jira/browse/CALCITE-3003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16833201#comment-16833201 ] 

Chunwei Lei commented on CALCITE-3003:
--------------------------------------

Fixed in [603f93d3fd242010a2fd3dd2dd658dbeea0a96fc|https://github.com/apache/calcite/commit/603f93d3fd242010a2fd3dd2dd658dbeea0a96fc]. Thanks for the PR, [~my7ym].

> 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
>            Assignee: Will Yu
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> 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)