You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2015/09/09 20:26:45 UTC

[jira] [Updated] (CALCITE-881) Allow schema.table.column references in GROUP BY

     [ https://issues.apache.org/jira/browse/CALCITE-881?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Hyde updated CALCITE-881:
--------------------------------
    Summary: Allow schema.table.column references in GROUP BY  (was: NPE when issuing GROUP BY against Derby)

> Allow schema.table.column references in GROUP BY
> ------------------------------------------------
>
>                 Key: CALCITE-881
>                 URL: https://issues.apache.org/jira/browse/CALCITE-881
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Marc Prud'hommeaux
>            Assignee: Julian Hyde
>
> This works fine:
> {noformat}
> SELECT DISTINCT "SA"."product"."brand_name" FROM "SA"."product";
> {noformat}
> But this raises an NPE:
> {noformat}
> Connecting to jdbc:calcite:model=inline:{"version":1.0,"defaultSchema":"SA","schemas":[{"name":"SA","type":"jdbc","jdbcSchema":"SA","jdbcUrl":"jdbc:derby:jar:(/opt/src/glimpse/glimpse/GlimpseServe/scala/target/scala-2.11/classes/derby-foodmart.zip)foodmart"}]}
> Connected to: Calcite (version 1.5.0-incubating-SNAPSHOT)
> Driver: Calcite JDBC Driver (version 1.5.0-incubating-SNAPSHOT)
> Autocommit status: true
> Transaction isolation: TRANSACTION_READ_UNCOMMITTED
> sqlline version 1.0.1 by Marc Prud'hommeaux
> 0: jdbc:calcite:model=inline:{"version":1.0,"> SELECT "SA"."product"."brand_name" FROM "SA"."product" GROUP BY "SA"."product"."brand_name";
> Error: error while executing SQL "SELECT "SA"."product"."brand_name" FROM "SA"."product" GROUP BY "SA"."product"."brand_name"": null (state=,code=0)
> java.sql.SQLException: error while executing SQL "SELECT "SA"."product"."brand_name" FROM "SA"."product" GROUP BY "SA"."product"."brand_name"": null
> 	at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
> 	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:112)
> 	at org.apache.calcite.avatica.AvaticaStatement.execute(AvaticaStatement.java:121)
> 	at sqlline.SqlLine$Commands.execute(Unknown Source)
> 	at sqlline.SqlLine$Commands.sql(Unknown Source)
> 	at sqlline.SqlLine.dispatch(Unknown Source)
> 	at sqlline.SqlLine.begin(Unknown Source)
> 	at sqlline.SqlLine.mainWithInputRedirection(Unknown Source)
> 	at sqlline.SqlLine.main(Unknown Source)
> Caused by: java.lang.NullPointerException
> 	at org.apache.calcite.sql.validate.IdentifierNamespace.resolve(IdentifierNamespace.java:187)
> 	at org.apache.calcite.sql.validate.IdentifierNamespace.getTable(IdentifierNamespace.java:195)
> 	at org.apache.calcite.sql.validate.ListScope.findChild(ListScope.java:110)
> 	at org.apache.calcite.sql.validate.ListScope.resolve(ListScope.java:164)
> 	at org.apache.calcite.sql.validate.DelegatingScope.resolve(DelegatingScope.java:80)
> 	at org.apache.calcite.sql.validate.DelegatingScope.fullyQualify(DelegatingScope.java:176)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl$Expander.visit(SqlValidatorImpl.java:4317)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl$Expander.visit(SqlValidatorImpl.java:4297)
> 	at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:271)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.expand(SqlValidatorImpl.java:4005)
> 	at org.apache.calcite.sql.validate.SqlValidatorUtil.analyzeGroupExpr(SqlValidatorUtil.java:455)
> 	at org.apache.calcite.sql.validate.SqlValidatorUtil.convertGroupSet(SqlValidatorUtil.java:426)
> 	at org.apache.calcite.sql.validate.SqlValidatorUtil.analyzeGroupItem(SqlValidatorUtil.java:401)
> 	at org.apache.calcite.sql.validate.AggregatingSelectScope.<init>(AggregatingSelectScope.java:94)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.registerQuery(SqlValidatorImpl.java:2166)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.registerQuery(SqlValidatorImpl.java:2088)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:802)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:518)
> 	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:564)
> 	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:223)
> 	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:189)
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:700)
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:586)
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:556)
> 	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:207)
> 	at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:563)
> 	at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:477)
> 	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:110)
> 	... 7 more
> {noformat}
> FTR, the same statement runs fine when executed directly against Derby.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)