use of org.apache.ignite.internal.sql.engine.rel.IgniteAggregate in project ignite-3 by apache.
the class AggregateDistinctPlannerTest method mapReduceDistinctWithIndex.
/**
* MapReduceDistinctWithIndex.
* TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*
* @throws Exception If failed.
*/
@ParameterizedTest
@EnumSource
public void mapReduceDistinctWithIndex(AggregateAlgorithm algo) throws Exception {
TestTable tbl = createAffinityTable().addIndex(RelCollations.of(ImmutableIntList.of(1, 2)), "val0_val1");
IgniteSchema publicSchema = new IgniteSchema("PUBLIC");
publicSchema.addTable("TEST", tbl);
String sql = "SELECT DISTINCT val0, val1 FROM test";
IgniteRel phys = physicalPlan(sql, publicSchema, algo.rulesToDisable);
IgniteAggregate mapAgg = findFirstNode(phys, byClass(algo.map));
IgniteReduceAggregateBase rdcAgg = findFirstNode(phys, byClass(algo.reduce));
assertNotNull(rdcAgg, "Invalid plan\n" + RelOptUtil.toString(phys, SqlExplainLevel.ALL_ATTRIBUTES));
assertNotNull(mapAgg, "Invalid plan\n" + RelOptUtil.toString(phys));
assertTrue(nullOrEmpty(rdcAgg.getAggregateCalls()), "Invalid plan\n" + RelOptUtil.toString(phys));
assertTrue(nullOrEmpty(mapAgg.getAggCallList()), "Invalid plan\n" + RelOptUtil.toString(phys));
if (algo == AggregateAlgorithm.SORT) {
assertNotNull(findFirstNode(phys, byClass(IgniteIndexScan.class)));
}
}
Aggregations