Unsure of where this is coming from/how to debug it.
(The code I am using is below, taken from Calcite examples)
If I print out the sub-schema names of "rootSchema", and their tables, I
get:
subSchemaNames: [hr, metadata]
"hr" subSchema table names: [depts, emps]
"metadata" subSchema table names: [COLUMNS, TABLES]
So I am not certain what value is being passed that it would fail
a "schema.getSubSchema()" call, or where to put a breakpoint to debug that.
Does anyone spot something I'm doing that's clearly wrong, or have an idea
where I could look to find the code that's causing this?
Stacktrace winds up at "Baz", so I think it's generated code
Thank you
===========================================================
fun main(args: Array<String>) {
val hr = Frameworks.createRootSchema(true).add("hr",
HrClusteredSchema())
val frameworkConfig: FrameworkConfig = Frameworks
.newConfigBuilder()
.parserConfig(SqlParser.config().withCaseSensitive(false))
.defaultSchema(hr)
.build()
Frameworks.withPlanner(::test, frameworkConfig)
}
fun test(cluster: RelOptCluster, relOptSchema: RelOptSchema, rootSchema:
Schema) {
val planner = cluster.planner
val relBuilder: RelBuilder =
RelFactories.LOGICAL_BUILDER.create(cluster, relOptSchema)
val relRoot: RelNode = // ...
val desiredTraits =
cluster.traitSet().replace(EnumerableConvention.INSTANCE)
val newRoot = cluster.planner.changeTraits(relRoot, desiredTraits)
cluster.planner.root = newRoot
val bestExp = cluster.planner.findBestExp()
val run = RelRunners.run(bestExp)
val resultSet = run.executeQuery()
}