calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Hyde <julianh...@gmail.com>
Subject Re: RuntimeException: while resolving method 'project'
Date Thu, 30 Oct 2014 22:15:52 GMT
That assert is keeping you honest! Every rule has to create something equivalent to its argument,
and that means that it has to have the same row type. (Column names may differ, but not types.)

On Oct 30, 2014, at 3:11 PM, Hartman, Trevor <thartman@ebay.com> wrote:

> Thanks, Julian.
> 
> Simply switching to j.u.List wasn't enough. I also had to resolve the Method myself as
you had suggested:
> 
>    val project: Method = classOf[ColumnarTable[S]].getMethod("project", classOf[JList[String]])
> 
>    implementor.result(
>      physType,
>      Blocks.toBlock(
>        Expressions.call(
>          table.getExpression(classOf[ColumnarTable[S]]),
>          project,
>          Expressions.constant(fields))))
> 
> I'll try using ProjectableFilterableTable when I get a chance to upgrade.
> 
> After fixing this, I enabled the rule in ColumnarProjectRule#onMatch with:
> 
>    val cts = new ColumnarTableScan[S](
>      scan.getCluster,
>      scan.getTable,
>      scan.columnarTable)
> 
>    call.transformTo(cts)
> 
> At this point the rule should be doing pretty much nothing. It's just a pass-through
to get it working. It compiles, but I get a runtime error from the `transformTo` call:
> 
> || java.lang.AssertionError: Internal error: Error while applying rule ColumnarProjectRule,
args [rel#25:ProjectRel.NONE.[](child=rel#6:Subset#0.ENUMERABLE.[],DUMMY=0), rel#0:ColumnarTableScan.ENUMERABLE.[](table=[listings,
listings])]
> || at org.eigenbase.util.Util.newInternal(Util.java:749)
> || at org.eigenbase.relopt.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:245)
> || at org.eigenbase.relopt.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:660)
> || at net.hydromatic.optiq.tools.Programs$5.run(Programs.java:234)
> || at net.hydromatic.optiq.tools.Programs$SequenceProgram.run(Programs.java:282)
> || at net.hydromatic.optiq.prepare.Prepare.optimize(Prepare.java:119)
> || at net.hydromatic.optiq.prepare.Prepare.prepareSql(Prepare.java:252)
> || at net.hydromatic.optiq.prepare.Prepare.prepareSql(Prepare.java:164)
> || at net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepare2_(OptiqPrepareImpl.java:377)
> || at net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepare_(OptiqPrepareImpl.java:285)
> || at net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepareSql(OptiqPrepareImpl.java:254)
> || at net.hydromatic.optiq.jdbc.OptiqConnectionImpl.parseQuery(OptiqConnectionImpl.java:150)
> || at net.hydromatic.optiq.jdbc.MetaImpl.prepare(MetaImpl.java:617)
> || at net.hydromatic.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:76)
> || at c.e.s.c.listings.sql.TryCalcite.query(TryCalcite.scala:45)
> ...
> 
> || Caused by: java.lang.AssertionError: Internal error: Error occurred while applying
rule ColumnarProjectRule
> || at org.eigenbase.util.Util.newInternal(Util.java:749)
> || at org.eigenbase.relopt.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:142)
> || at org.eigenbase.relopt.RelOptRuleCall.transformTo(RelOptRuleCall.java:209)
> || at c.e.s.c.query.sql.ColumnarProjectRule.onMatch(ColumnarProjectRule.scala:35)
> || at org.eigenbase.relopt.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:222)
> || ... 54 more
> || Caused by: java.lang.AssertionError: Type mismatch:
> || rel rowtype:
> || RecordType((VARCHAR(1) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary"
NOT NULL, ANY NOT NULL) MAP NOT NULL _MAP) NOT NULL
> || equivRel rowtype:
> || RecordType(INTEGER NOT NULL DUMMY) NOT NULL
> || at org.eigenbase.relopt.RelOptUtil.equal(RelOptUtil.java:1498)
> || at org.eigenbase.relopt.volcano.VolcanoPlanner.register(VolcanoPlanner.java:834)
> || at org.eigenbase.relopt.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:865)
> || at org.eigenbase.relopt.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1761)
> || at org.eigenbase.relopt.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:130)
> || ... 57 more
> 
> Do you know what would cause that?
> 
> 


Mime
View raw message