calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hartman, Trevor" <>
Subject Working with a RexCall tree in Filter
Date Fri, 06 Mar 2015 18:02:31 GMT
I'm working on pushing down filtering. In my own Filter rel impl, I see `condition` is represented
as a RexCall, with the appropriate operations and operands.

e.g. where id = 1 AND (photoCount > 0 OR quantity > 0) builds up a RexCall tree with
AND as the root op.

To implement filtering, I need a method like:
def passesFilter(expr: RexCall, fields: Map[String, Any]): Boolean

As I scan my table, I'd check passesFilter for each row, passing in a Map with keys id, photoCount
and quantity in this case.

In reality, I'd probably use a translator (implements RexVisitorImpl) to turn the RexCall
into a data structure that's easier to work with in Scala. However, looking through Calcite
source, I see some things like RexExecutor, which led me to wonder:

Is there anything in Calcite that can help me define `passesFilter` without me having to manually
walk an expression tree and evaluate the conditions? The built-in Filter implementation must
be doing this already, but I'm not sure how or if I can reuse that.

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