Search in sources :

Example 1 with IgniteReduceSortAggregate

use of org.apache.ignite.internal.sql.engine.rel.agg.IgniteReduceSortAggregate in project ignite-3 by apache.

the class SortAggregatePlannerTest method collationPermuteMapReduce.

/**
 * CollationPermuteMapReduce.
 * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
 *
 * @throws Exception If failed.
 */
@Test
public void collationPermuteMapReduce() throws Exception {
    IgniteTypeFactory f = new IgniteTypeFactory(IgniteTypeSystem.INSTANCE);
    TestTable tbl = new TestTable(new RelDataTypeFactory.Builder(f).add("ID", f.createJavaType(Integer.class)).add("VAL0", f.createJavaType(Integer.class)).add("VAL1", f.createJavaType(Integer.class)).add("GRP0", f.createJavaType(Integer.class)).add("GRP1", f.createJavaType(Integer.class)).build()) {

        @Override
        public IgniteDistribution distribution() {
            return IgniteDistributions.affinity(0, "test", "hash");
        }
    }.addIndex(RelCollations.of(ImmutableIntList.of(3, 4)), "grp0_1");
    IgniteSchema publicSchema = new IgniteSchema("PUBLIC");
    publicSchema.addTable("TEST", tbl);
    String sql = "SELECT MIN(val0) FROM test GROUP BY grp1, grp0";
    IgniteRel phys = physicalPlan(sql, publicSchema, "HashSingleAggregateConverterRule", "HashMapReduceAggregateConverterRule");
    IgniteReduceSortAggregate agg = findFirstNode(phys, byClass(IgniteReduceSortAggregate.class));
    assertNotNull(agg, "Invalid plan\n" + RelOptUtil.toString(phys));
    assertNull(findFirstNode(phys, byClass(IgniteSort.class)), "Invalid plan\n" + RelOptUtil.toString(phys));
}
Also used : IgniteTypeFactory(org.apache.ignite.internal.sql.engine.type.IgniteTypeFactory) IgniteRel(org.apache.ignite.internal.sql.engine.rel.IgniteRel) IgniteSchema(org.apache.ignite.internal.sql.engine.schema.IgniteSchema) IgniteDistribution(org.apache.ignite.internal.sql.engine.trait.IgniteDistribution) IgniteReduceSortAggregate(org.apache.ignite.internal.sql.engine.rel.agg.IgniteReduceSortAggregate) Test(org.junit.jupiter.api.Test)

Aggregations

IgniteRel (org.apache.ignite.internal.sql.engine.rel.IgniteRel)1 IgniteReduceSortAggregate (org.apache.ignite.internal.sql.engine.rel.agg.IgniteReduceSortAggregate)1 IgniteSchema (org.apache.ignite.internal.sql.engine.schema.IgniteSchema)1 IgniteDistribution (org.apache.ignite.internal.sql.engine.trait.IgniteDistribution)1 IgniteTypeFactory (org.apache.ignite.internal.sql.engine.type.IgniteTypeFactory)1 Test (org.junit.jupiter.api.Test)1