Search in sources :

Example 1 with IgniteAggregate

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)));
    }
}
Also used : IgniteAggregate(org.apache.ignite.internal.sql.engine.rel.IgniteAggregate) IgniteReduceAggregateBase(org.apache.ignite.internal.sql.engine.rel.agg.IgniteReduceAggregateBase) IgniteRel(org.apache.ignite.internal.sql.engine.rel.IgniteRel) IgniteSchema(org.apache.ignite.internal.sql.engine.schema.IgniteSchema) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

IgniteAggregate (org.apache.ignite.internal.sql.engine.rel.IgniteAggregate)1 IgniteRel (org.apache.ignite.internal.sql.engine.rel.IgniteRel)1 IgniteReduceAggregateBase (org.apache.ignite.internal.sql.engine.rel.agg.IgniteReduceAggregateBase)1 IgniteSchema (org.apache.ignite.internal.sql.engine.schema.IgniteSchema)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 EnumSource (org.junit.jupiter.params.provider.EnumSource)1