Strictly there’s no such things as a ‘pushdown rule’. Every rule needs to 
produce an equivalent relational expression. And therefore rules are typically 
’swaps’ - the rule that pushes a filter through a join is, in some sense, 
pulling the join through the filter. It matches a filter on top of a join and 
then goes to work.

The rules that push processing into another engine are also ’swaps’. You might 
write a rule that matches a filter on top of a X-to-Y-converter where X and Y 
are conventions, and therefore the filter is handling the data in Y format. The 
rule might create an X-to-Y-converter on top of a filter that is handling data 
in X format.

If you are dealing with remote database you likely need a new convention, 
therefore an adapter. The tutorial that Stamatis and I gave at BOSS ’21 [1] 
explains how to write such rules.

Julian

[1] 
https://www.slideshare.net/julianhyde/apache-calcite-a-tutorial-given-at-boss-21

> On Feb 27, 2023, at 10:53 AM, Jonathan Sternberg <[email protected]> wrote:
> 
> Hi,
> 
> I'm looking to implement a planner rule for Calcite that can only trigger
> if reading from a table in a specific catalog implementation. For example,
> the planner rule should not trigger if reading from the catalog that
> represents the in-memory database, but I'd like to do a specific
> optimization when reading from a remote database because it's more
> efficient to push down the logic to the server than to read the data into
> the client and perform the transformation there.
> 
> I've been trying to identify the way that I'm meant to do this. If I can
> just get a little nudge in the correct direction, that would be incredibly
> helpful.
> 
> Thank you.
> 
> --Jonathan Sternberg

Reply via email to