use of org.apache.beam.sdk.extensions.sql.impl.rel.BeamIOSourceRel in project beam by apache.
the class BeamAggregateProjectMergeRuleTest method testBeamAggregateProjectMergeRule_withProjectTable.
@Test
public void testBeamAggregateProjectMergeRule_withProjectTable() {
// When an IO supports project push-down, Projects should be merged with an IO.
String sqlQuery = "select SUM(id) as id_sum from TEST_PROJECT group by name";
BeamRelNode beamRel = sqlEnv.parseQuery(sqlQuery);
BeamAggregationRel aggregate = (BeamAggregationRel) beamRel.getInput(0);
BeamIOSourceRel ioSourceRel = (BeamIOSourceRel) aggregate.getInput();
// Make sure project push-down took place.
assertThat(ioSourceRel, instanceOf(BeamPushDownIOSourceRel.class));
assertThat(ioSourceRel.getRowType().getFieldNames(), containsInAnyOrder("name", "id"));
}
Aggregations