Search in sources :

Example 1 with IgniteSingleSortAggregate

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

the class SortAggregatePlannerTest method collationPermuteSingle.

/**
 * CollationPermuteSingle.
 * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
 *
 * @throws Exception If failed.
 */
@Test
public void collationPermuteSingle() 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.broadcast();
        }
    }.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");
    IgniteSingleSortAggregate agg = findFirstNode(phys, byClass(IgniteSingleSortAggregate.class));
    assertNotNull(agg, "Invalid plan\n" + RelOptUtil.toString(phys));
    assertNull(findFirstNode(phys, byClass(IgniteSort.class)), "Invalid plan\n" + RelOptUtil.toString(phys));
}
Also used : IgniteSingleSortAggregate(org.apache.ignite.internal.sql.engine.rel.agg.IgniteSingleSortAggregate) 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) Test(org.junit.jupiter.api.Test)

Aggregations

IgniteRel (org.apache.ignite.internal.sql.engine.rel.IgniteRel)1 IgniteSingleSortAggregate (org.apache.ignite.internal.sql.engine.rel.agg.IgniteSingleSortAggregate)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