use of org.apache.ignite.internal.sql.engine.rel.IgniteUnionAll in project ignite-3 by apache.
the class UnionConverterRule method onMatch.
/**
* {@inheritDoc}
*/
@Override
public void onMatch(RelOptRuleCall call) {
final LogicalUnion union = call.rel(0);
RelOptCluster cluster = union.getCluster();
RelTraitSet traits = cluster.traitSetOf(IgniteConvention.INSTANCE);
List<RelNode> inputs = Commons.transform(union.getInputs(), input -> convert(input, traits));
RelNode res = new IgniteUnionAll(cluster, traits, inputs);
if (!union.all) {
final RelBuilder relBuilder = relBuilderFactory.create(union.getCluster(), null);
relBuilder.push(res).aggregate(relBuilder.groupKey(ImmutableBitSet.range(union.getRowType().getFieldCount())));
res = convert(relBuilder.build(), union.getTraitSet());
}
call.transformTo(res);
}
Aggregations