use of com.hazelcast.jet.sql.impl.opt.SlidingWindow in project hazelcast by hazelcast.
the class SlidingWindowFilterTransposeRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final Filter filter = call.rel(0);
final SlidingWindow sw = call.rel(1);
RexVisitorImpl<Void> visitor = new RexVisitorImpl<Void>(true) {
@Override
public Void visitInputRef(RexInputRef ref) {
int index = ref.getIndex();
if (index == sw.windowStartIndex() || index == sw.windowEndIndex()) {
throw QueryException.error("Can't apply filter criteria to window bounds");
}
return super.visitInputRef(ref);
}
};
filter.getCondition().accept(visitor);
final Filter newFilter = filter.copy(filter.getTraitSet(), sw.getInput(), filter.getCondition());
final SlidingWindow topSW = (SlidingWindow) sw.copy(sw.getTraitSet(), singletonList(newFilter));
call.transformTo(topSW);
}
use of com.hazelcast.jet.sql.impl.opt.SlidingWindow in project hazelcast by hazelcast.
the class SlidingWindowJoinTransposeRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
// TODO [sasha]: finish in follow-up PR
final Join join = call.rel(0);
final SlidingWindow sw = call.rel(1);
boolean windowIsLeftInput = ((RelSubset) join.getLeft()).getBest() instanceof SlidingWindow;
Join newJoin;
if (windowIsLeftInput) {
newJoin = join.copy(join.getTraitSet(), join.getCondition(), sw.getInput(), join.getRight(), join.getJoinType(), join.isSemiJoinDone());
} else {
newJoin = join.copy(join.getTraitSet(), join.getCondition(), join.getLeft(), sw.getInput(), join.getJoinType(), join.isSemiJoinDone());
}
final SlidingWindow topSW = (SlidingWindow) sw.copy(sw.getTraitSet(), singletonList(newJoin));
call.transformTo(topSW);
}
Aggregations