use of org.apache.ignite.internal.sql.engine.rel.agg.IgniteSingleAggregateBase in project ignite-3 by apache.
the class AggregatePlannerTest method distribution.
/**
* Test that aggregate has single distribution output even if parent node accept random distibution inputs.
*
* @throws Exception If failed.
*/
@ParameterizedTest
@EnumSource
public void distribution(AggregateAlgorithm algo) throws Exception {
TestTable tbl = createAffinityTable().addIndex(RelCollations.of(ImmutableIntList.of(3)), "grp0");
IgniteSchema publicSchema = new IgniteSchema("PUBLIC");
publicSchema.addTable("TEST", tbl);
String sql = "SELECT AVG(val0), grp0 FROM TEST GROUP BY grp0 UNION ALL SELECT val0, grp0 FROM test";
IgniteRel phys = physicalPlan(sql, publicSchema, concat(algo.rulesToDisable, "SortMapReduceAggregateConverterRule", "HashMapReduceAggregateConverterRule"));
IgniteSingleAggregateBase singleAgg = findFirstNode(phys, byClass(algo.single));
assertEquals(IgniteDistributions.single(), TraitUtils.distribution(singleAgg));
phys = physicalPlan(sql, publicSchema, concat(algo.rulesToDisable, "SortSingleAggregateConverterRule", "HashSingleAggregateConverterRule"));
IgniteReduceAggregateBase rdcAgg = findFirstNode(phys, byClass(algo.reduce));
assertEquals(IgniteDistributions.single(), TraitUtils.distribution(rdcAgg));
}
use of org.apache.ignite.internal.sql.engine.rel.agg.IgniteSingleAggregateBase in project ignite-3 by apache.
the class AggregatePlannerTest method singleWithIndex.
/**
* SingleWithIndex.
* TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*
* @throws Exception If failed.
*/
@ParameterizedTest
@EnumSource
public void singleWithIndex(AggregateAlgorithm algo) throws Exception {
TestTable tbl = createBroadcastTable().addIndex(RelCollations.of(ImmutableIntList.of(3, 4)), "grp0_grp1");
IgniteSchema publicSchema = new IgniteSchema("PUBLIC");
publicSchema.addTable("TEST", tbl);
String sql = "SELECT AVG(val0) FILTER(WHERE val1 > 10) FROM test GROUP BY grp0";
IgniteRel phys = physicalPlan(sql, publicSchema, algo.rulesToDisable);
IgniteSingleAggregateBase agg = findFirstNode(phys, byClass(algo.single));
assertNotNull(agg, "Invalid plan\n" + RelOptUtil.toString(phys));
assertThat("Invalid plan\n" + RelOptUtil.toString(phys), first(agg.getAggCallList()).getAggregation(), IsInstanceOf.instanceOf(SqlAvgAggFunction.class));
if (algo == AggregateAlgorithm.SORT) {
assertNotNull(findFirstNode(phys, byClass(IgniteIndexScan.class)));
}
}
use of org.apache.ignite.internal.sql.engine.rel.agg.IgniteSingleAggregateBase in project ignite-3 by apache.
the class AggregatePlannerTest method singleWithoutIndex.
/**
* SingleWithoutIndex.
* TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*
* @throws Exception If failed.
*/
@ParameterizedTest
@EnumSource
public void singleWithoutIndex(AggregateAlgorithm algo) throws Exception {
TestTable tbl = createBroadcastTable().addIndex(RelCollations.of(ImmutableIntList.of(1, 2)), "val0_val1");
IgniteSchema publicSchema = new IgniteSchema("PUBLIC");
publicSchema.addTable("TEST", tbl);
String sql = "SELECT AVG(val0) FROM test GROUP BY grp0";
IgniteRel phys = physicalPlan(sql, publicSchema, algo.rulesToDisable);
IgniteSingleAggregateBase agg = findFirstNode(phys, byClass(algo.single));
assertNotNull(agg, "Invalid plan\n" + RelOptUtil.toString(phys));
assertThat("Invalid plan\n" + RelOptUtil.toString(phys), first(agg.getAggCallList()).getAggregation(), IsInstanceOf.instanceOf(SqlAvgAggFunction.class));
if (algo == AggregateAlgorithm.SORT) {
assertNotNull(findFirstNode(phys, byClass(IgniteSort.class)));
}
}
Aggregations