0

I'm trying generate SQL statement out of a relational algebra model that uses a table sample expression. But it seems that the RelToSqlConverter class doesn't have an implementation for the Sample class which is used to represent the table sample expression. Did anybody manage to perform such a conversion? Any help is appreciated.

RelNode test2 = builder.scan("tables").build();
Sample sample = new Sample(test2.getCluster(), test2, new RelOptSamplingParameters(true, 1.f, true, 0));
SqlDialect dialect = SqlDialect.DatabaseProduct.CALCITE.getDialect();
final RelToSqlConverter converter = new RelToSqlConverter(dialect);    
final SqlNode sqlNode = converter.visitRoot(sample).asStatement(); // the failing line, visitRoot call

The failing method in the RelToSqlConverter class:

/** Visits a RelNode; called by {@link #dispatch} via reflection. */
  public Result visit(RelNode e) {
    throw new AssertionError("Need to implement " + e.getClass().getName());
  }

Do I need to use some child class of Sample or extend RelToSqlConverter?

Thanks in advance.

Ant
  • 63
  • 8

0 Answers0