You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Hartman, Trevor" <th...@ebay.com> on 2014/11/13 19:08:56 UTC
Re: RuntimeException: while resolving method 'project'
Picking this back up. With my ColumnarProjectRule enabled, I'm able to successfully run:
select count(_MAP['listingId']) as rowcount from "listings"."listings"
Side note: I noticed this triggers my ColumnarProjectRule, which extends:
RelOptRule(operand(classOf[ProjectRel],
operand(classOf[ColumnarTableScan[S]], none())),
"ColumnarProjectRule")
Why would an aggregate function `count` match on a ProjectRel?
Main question: why does this error when my ColumnarProjectRule is enabled?
select _MAP['listingId'], _MAP['applicationId'] from "listings"."listings"
|| 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(ANY EXPR$0, ANY EXPR$1) NOT NULL
If I disable my ColumnarProjectRule, it works. I'm not specifying any types, except for getRowType in my ColumnarTable. Should I be?
At this point I only have the single rule registered, and it doesn't do anything yet. Just trying to understand the flow/mechanics. Here's the rule source for reference (Scala):
class ColumnarProjectRule[S <: Schema]()(implicit ct: ClassTag[S])
extends RelOptRule(operand(classOf[ProjectRel],
operand(classOf[ColumnarTableScan[S]], none())),
"ColumnarProjectRule")
with StrictLogging {
override def onMatch(call: RelOptRuleCall) {
val project: ProjectRel = call.rel(0)
val scan: ColumnarTableScan[S] = call.rel(1)
val projects = project.getProjects()
logger.info(s"onMatch $project ${project.getTraitSet} ${project.getProjects}")
// TODO: determine fields to pass into ColumnarTableScan
// val fields = Seq.empty[String].asJava
val cts = new ColumnarTableScan[S](
scan.getCluster,
scan.getTable,
scan.columnarTable)
call.transformTo(cts)
}
}
Thanks,
Trevor