Hi everyone, I'm having troubles transforming a RelNode to SQL. When running this code:
RelToSqlConverter converter = new RelToSqlConverter(SqlDialect.DatabaseProduct.CALCITE.getDialect()); SqlImplementor.Result result = converter.visitRoot(relNode); I'm getting the following error on visitRoot: Need to implement org.apache.calcite.adapter.jdbc.JdbcToEnumerableConverter As the RelToSqlConverter only takes a dialect as an argument, and visitRoot a RelNode, I suspect the error comes from the planning. To build my RelNode, I'm running the optimizer. It works without error and seems to optimize the statement, but this RelNode seems not suitable for the RelToSqlConverter later on. Here is how I run the optimizer: RelOptCluster cluster = rel.getCluster(); RelOptPlanner planner = cluster.getPlanner(); // JdbcConvention convention = new JdbcConvention(SqlDialect .DatabaseProduct.CALCITE.getDialect(), new DefaultExpression(RelNode.class), "my_schema"); RelTraitSet desiredTraits = cluster.traitSet().plus(EnumerableConvention.INSTANCE); //.plus(convention); RelNode newRoot = planner.changeTraits(rel, desiredTraits); planner.setRoot(newRoot); RelNode optimizedNode = planner.findBestExp(); As you can see commented out, I've tried adding the JdbcConvention but it doesn't work, and I don't get how to include the JdbcToEnumerableConverter. If you have any hints as to where the error could come from, this would be truly awesome!! Have a great day, Florent
