calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abishek Baskaran <abishek.baska...@gmail.com>
Subject Filter Push down - passing RexCall from EnumerableRel implement method.
Date Wed, 17 Sep 2014 16:14:05 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message