You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Alexey Roytman (JIRA)" <ji...@apache.org> on 2017/11/07 14:36:00 UTC

[jira] [Updated] (CALCITE-2039) AssertionError at Mappings.create(Mappings.java:64) with "select 0 as c1,..." and TableProjectableFilterable

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

Alexey Roytman updated CALCITE-2039:
------------------------------------
    Summary: AssertionError at Mappings.create(Mappings.java:64) with "select 0 as c1,..." and TableProjectableFilterable  (was: AssertionError at Mappings.create(Mappings.java:64) )

> AssertionError at Mappings.create(Mappings.java:64) with "select 0 as c1,..." and TableProjectableFilterable
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-2039
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2039
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.14.0
>            Reporter: Alexey Roytman
>            Assignee: Julian Hyde
>
> When I use a ProjectableFilterableTable interface, the following query (notice the "select 0 as c1, ...")
> select 0 as c1, D101.c1 as c3, D101.c2 as c4, D101.c3 as c5 from (
>   select T1000001.Category as c1, T1000001.Revenue as c2,
>   T1000001.\"YEAR\" as c3 from (
>     select "YEAR", Category, "MONTH", Territory, Quarter, Sub_Category,
>     Age_Group, Gender, Country, Revenue, Num_Of_Orders, "DATE" from
>       XSchema.HDP) T1000001) D101
> causes an exception:
> java.lang.AssertionError
> 	at org.apache.calcite.util.mapping.Mappings.create(Mappings.java:64)
> 	at org.apache.calcite.rel.core.Project.getMapping(Project.java:277)
> 	at org.apache.calcite.rel.core.Project.getMapping(Project.java:257)
> 	at org.apache.calcite.rel.rules.ProjectTableScanRule.apply(ProjectTableScanRule.java:100)
> 	at org.apache.calcite.rel.rules.ProjectTableScanRule$3.onMatch(ProjectTableScanRule.java:83)
> 	at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:212)
> 	at org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:650)
> 	at org.apache.calcite.tools.Programs$5.run(Programs.java:326)
> 	at org.apache.calcite.tools.Programs$SequenceProgram.run(Programs.java:387)
> 	at org.apache.calcite.prepare.Prepare.optimize(Prepare.java:188)
> 	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:321)
> 	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:230)
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:786)
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:640)
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:610)
> 	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:221)
> 	at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:603)
> 	at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:638)
> 	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:149)
> 	at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218)
>         ...
> In the Mappings.create(), mappingType is INVERSE_SURJECTION, and "assert sourceCount >= targetCount" throws the exception, because sourceCount is 3, and targetCount is 4.
> At the frame above, in Project.getMapping(), "projects" are: [0, $1, $2, $0] (1st is RexLiteral, others are RexInputRef).
> At the frame above, in EnumerableProject.getMapping(), getInput().getRowType() has only 3 fields in the table.
> I have a reproduction case (in Java) but it's not within a Calcite standard.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)