>A query with an Aggregate, and a Filter:

Java code is broken there. It looks like a copy&paste error.

>Creating an expression in Calcite's relational algebra has always been too
complicated

1) Can you please show "a complicated rule" being rewritten to this nice API?
I do not want to diminish the value of the API, it might well serve its purpose.

2) Adding correlations into the equations might be tricky.
Try something like "select deptno from depts where exists (select null
from emps where empno = deptno+1)".

I have not faced a case when it was hard to pass all the required parameters.
Usually, it is very tricky to figure out all those
permute(fromMapping(toInversePermutation))) kind of field shuffling.
Those code becomes a write-only code. It does not look like the
builder solves this problem.

Here's a random quote from the sources (~RelFieldTrimmer). Who on
Earth can understand that? Well, someone can, but is complicated.

// Offset due to the number of system fields having changed.
Mapping mapping =
    Mappings.create(
        MappingType.INVERSE_SURJECTION,
        rowType.getFieldCount(),
        groupCount + indicatorCount + usedAggCallCount);

final ImmutableBitSet newGroupSet =
    Mappings.apply(inputMapping, aggregate.getGroupSet());

final ImmutableList<ImmutableBitSet> newGroupSets =
    ImmutableList.copyOf(
        Iterables.transform(aggregate.getGroupSets(),
            new Function<ImmutableBitSet, ImmutableBitSet>() {
              public ImmutableBitSet apply(ImmutableBitSet input) {
                return Mappings.apply(inputMapping, input);
              }
            }));


Vladimir

Reply via email to