You have two calls to “build”. That looks wrong, because “build” pops an entry 
off the stack.

If your intention is to swap the filters then you should push them in the 
reverse order than you are currently pushing them.

Lastly, RelBuilder.filter might try to merge consecutive filter nodes. If it 
does — and I don’t recall whether it does — your filter had better be flagged 
non-deterministic (or something) to prevent the merge from happening.

Julian

> On Nov 14, 2016, at 1:06 AM, Γιώργος Θεοδωράκης <[email protected]> 
> wrote:
> 
> Hello,
> 
> I want to create a rule that pushes a filter through another filter ( I
> don't merge them) according to their selectivities to optimize the final
> plan. I am using other rules as templates to create it but I keep getting
> errors, as I haven't understood correctly the basics. I want to have
> something like this :
> 
>  public void onMatch(RelOptRuleCall call) {
>    final Filter filter = call.rel(0);
>    final Filter secFilter = call.rel(1);
>    final RelBuilder relBuilder = call.builder();
>    relBuilder.push(filter)
>    .filter(secFilter.getCondition())
>    .build();
>    call.transformTo(relBuilder.build());
> }

Reply via email to