Hi,
I need to push down the filter expression to my custom data source. I see
that Optiq represents the filter expression as a RexCall and I wish to pass
the RexCall object to my custom table. I am able to pass Strings and
Arrays, but unable to figure out how to pass RexCall.

For example, in this codebase
<https://github.com/julianhyde/optiq-csv/blob/master/src/main/java/net/hydromatic/optiq/impl/csv/CsvTableScan.java>
,
We have the implement method that's called on successful push down rule.

  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
    PhysType physType =
        PhysTypeImpl.of(
            implementor.getTypeFactory(),
            getRowType(),
            pref.preferArray());

    if (table instanceof JsonTable) {
      return implementor.result(
          physType,
          Blocks.toBlock(
              Expressions.call(table.getExpression(JsonTable.class),
                  "enumerable")));
    }
    return implementor.result(
        physType,
        Blocks.toBlock(
            Expressions.call(table.getExpression(CsvTable.class), "project",
                Expressions.constant(fields))));
  }

Expressions.constant(fields) is good for Strings/Arrays. From Splunk
adapter I also figured out how to pass Lists. My requirement is to pass a
RexCall object, would appreciate any guidance here.

Thanks,
Abishek

Reply via email to