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 20:23:21 GMT
The error message could be more helpful — I wish it showed the parameters that it was looking
for — but yes, I suspect it’s a java-scala interop issue. Remember that there is no Seq
in Java, and type parameters are erased. Also, I think Expressions.constant() will tend to
return a List, not a Seq, and Scala might not get the chance to futz with that List and convert
it into a Seq.

So, creating a method “project(java.util.List)”.

You might try using Expressions.call(Expression, Method, Expression…) rather than Expressions.call(Expression,
String, Expression…). Then you are doing the overload-resolution, rather than linq4j.

Yes, there is a way to do this without linq4j. Use the new ProjectableFilterableTable interface
(just added in https://issues.apache.org/jira/browse/CALCITE-436 and committed to master branch
— it’s not in 0.9.1-incubating — you’ll have to build 0.9.2-incubating-SNAPSHOT yourself).

I think you should try both approaches.

Julian

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

> Hello,
> 
> I'm trying to write my first RelOptRule to handle projection for a custom Scala-based
distributed columnar database.
> 
> In my ColumnarTableScan#implement method:
> 
>    implementor.result(
>      physType,
>      Blocks.toBlock(
>        Expressions.call(table.getExpression(classOf[ColumnarTable[S]]),
>          "project",
>          Expressions.constant(fields))))
> 
> Results in:
> 
> || Caused by: java.lang.RuntimeException: while resolving method 'project' in class class
c.e.s.c.query.sql.ColumnarTable
> || at net.hydromatic.linq4j.expressions.Expressions.call(Expressions.java:408)
> || at net.hydromatic.linq4j.expressions.Expressions.call(Expressions.java:419)
> || at c.e.s.c.query.sql.ColumnarTableScan.implement(ColumnarTableScan.scala:49)
> || at net.hydromatic.optiq.rules.java.EnumerableRelImplementor.visitChild(EnumerableRelImplementor.java:59)
> || at net.hydromatic.optiq.rules.java.JavaRules$EnumerableCalcRel.implement(JavaRules.java:773)
> || at net.hydromatic.optiq.rules.java.EnumerableRelImplementor.visitChild(EnumerableRelImplementor.java:59)
> || at net.hydromatic.optiq.rules.java.JavaRules$EnumerableAggregateRel.implement(JavaRules.java:1004)
> || at net.hydromatic.optiq.rules.java.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:64)
> || at net.hydromatic.optiq.prepare.OptiqPrepareImpl$OptiqPreparingStmt.implement(OptiqPrepareImpl.java:759)
> || at net.hydromatic.optiq.prepare.Prepare.prepareSql(Prepare.java:265)
> || 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)
> || ... 42 more
> || Caused by: java.lang.NoSuchMethodException: c.e.s.c.query.sql.ColumnarTable.project(scala.collection.immutable.$colon$colon)
> || at java.lang.Class.getMethod(Class.java:1665)
> || at net.hydromatic.linq4j.expressions.Expressions.call(Expressions.java:405)
> || ... 58 more
> 
> To be clear, I don't actually understand what's going on with the Linq4j expression above;
I'm slowly learning calcite by example via the csv and mongo adapters. But from what I understand,
"project" should be a public method on ColumnarTable which takes a Seq[String]. It's there,
so not sure what the problem is. Could it be that there's some scala/java interop issues with
dynamically creating a class (or whatever Linq4j is doing)? Is there a way to do this without
linq4j?
> 
> Thanks,
> Trevor


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message