use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project calcite by apache.
the class PigRelBuilderStyleTest method testImplWithGroupByMultipleFields.
@Test
@Ignore("CALCITE-1751")
public void testImplWithGroupByMultipleFields() {
final SchemaPlus schema = createTestSchema();
final RelBuilder builder = createRelBuilder(schema);
final RelNode node = builder.scan("t").aggregate(builder.groupKey("tc1", "tc0"), builder.count(false, "c", builder.field("tc1"))).build();
final RelNode optimized = optimizeWithVolcano(node);
assertScriptAndResults("t", getPigScript(optimized, schema), "t = LOAD 'target/data.txt" + "' USING PigStorage() AS (tc0:chararray, tc1:chararray);\n" + "t = GROUP t BY (tc0, tc1);\n" + "t = FOREACH t {\n" + " GENERATE group.tc0 AS tc0, group.tc1 AS tc1, COUNT(t.tc1) AS c;\n" + "};", new String[] { "(a,1,1)", "(b,2,1)", "(c,3,1)" });
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project calcite by apache.
the class PigRelBuilderStyleTest method testImplWithJoin.
@Test
public void testImplWithJoin() throws Exception {
final SchemaPlus schema = createTestSchema();
final RelBuilder builder = createRelBuilder(schema);
final RelNode node = builder.scan("t").scan("s").join(JoinRelType.INNER, builder.equals(builder.field(2, 0, "tc1"), builder.field(2, 1, "sc0"))).filter(builder.call(GREATER_THAN, builder.field("tc0"), builder.literal("a"))).build();
final RelNode optimized = optimizeWithVolcano(node);
assertScriptAndResults("t", getPigScript(optimized, schema), "t = LOAD 'target/data.txt" + "' USING PigStorage() AS (tc0:chararray, tc1:chararray);\n" + "t = FILTER t BY (tc0 > 'a');\n" + "s = LOAD 'target/data2.txt" + "' USING PigStorage() AS (sc0:chararray, sc1:chararray);\n" + "t = JOIN t BY tc1 , s BY sc0;", new String[] { "(b,2,2,label2)" });
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project calcite by apache.
the class PigRelBuilderStyleTest method testScanAndFilter.
@Test
public void testScanAndFilter() throws Exception {
final SchemaPlus schema = createTestSchema();
final RelBuilder builder = createRelBuilder(schema);
final RelNode node = builder.scan("t").filter(builder.call(GREATER_THAN, builder.field("tc0"), builder.literal("abc"))).build();
final RelNode optimized = optimizeWithVolcano(node);
assertScriptAndResults("t", getPigScript(optimized, schema), "t = LOAD 'target/data.txt" + "' USING PigStorage() AS (tc0:chararray, tc1:chararray);\n" + "t = FILTER t BY (tc0 > 'abc');", new String[] { "(b,2)", "(c,3)" });
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project calcite by apache.
the class PigRelBuilderStyleTest method testImplWithMultipleFilters.
@Test
@Ignore("CALCITE-1751")
public void testImplWithMultipleFilters() {
final SchemaPlus schema = createTestSchema();
final RelBuilder builder = createRelBuilder(schema);
final RelNode node = builder.scan("t").filter(builder.and(builder.call(GREATER_THAN, builder.field("tc0"), builder.literal("abc")), builder.call(EQUALS, builder.field("tc1"), builder.literal("3")))).build();
final RelNode optimized = optimizeWithVolcano(node);
assertScriptAndResults("t", getPigScript(optimized, schema), "t = LOAD 'target/data.txt" + "' USING PigStorage() AS (tc0:chararray, tc1:chararray);\n" + "t = FILTER t BY (tc0 > 'abc') AND (tc1 == '3');", new String[] { "(c,3)" });
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project calcite by apache.
the class PigRelBuilderStyleTest method testImplWithGroupByAndCount.
@Test
@Ignore("CALCITE-1751")
public void testImplWithGroupByAndCount() {
final SchemaPlus schema = createTestSchema();
final RelBuilder builder = createRelBuilder(schema);
final RelNode node = builder.scan("t").aggregate(builder.groupKey("tc0"), builder.count(false, "c", builder.field("tc1"))).build();
final RelNode optimized = optimizeWithVolcano(node);
assertScriptAndResults("t", getPigScript(optimized, schema), "t = LOAD 'target/data.txt" + "' USING PigStorage() AS (tc0:chararray, tc1:chararray);\n" + "t = GROUP t BY (tc0);\n" + "t = FOREACH t {\n" + " GENERATE group AS tc0, COUNT(t.tc1) AS c;\n" + "};", new String[] { "(a,1)", "(b,1)", "(c,1)" });
}
Aggregations