use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Project in project druid by druid-io.
the class DruidRelsTest method test_isScanOrMapping_nonMappingUnion.
@Test
public void test_isScanOrMapping_nonMappingUnion() {
final Project project = mockNonMappingProject();
final DruidRel<?> rel = mockDruidRel(DruidUnionDataSourceRel.class, PartialDruidQuery.Stage.SELECT_PROJECT, null, project, null);
Assert.assertFalse(DruidRels.isScanOrMapping(rel, true));
Assert.assertFalse(DruidRels.isScanOrMapping(rel, false));
EasyMock.verify(rel, rel.getPartialDruidQuery(), project);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Project in project druid by druid-io.
the class DruidRelsTest method test_isScanOrMapping_filterThenProject.
@Test
public void test_isScanOrMapping_filterThenProject() {
final Project project = mockMappingProject(ImmutableList.of(1, 0), 2);
final DruidRel<?> rel = mockDruidRel(DruidQueryRel.class, PartialDruidQuery.Stage.SELECT_PROJECT, null, project, mockFilter());
Assert.assertFalse(DruidRels.isScanOrMapping(rel, true));
Assert.assertFalse(DruidRels.isScanOrMapping(rel, false));
EasyMock.verify(rel, rel.getPartialDruidQuery(), project);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Project in project druid by druid-io.
the class DruidRelsTest method test_isScanOrMapping_mappingJoin.
@Test
public void test_isScanOrMapping_mappingJoin() {
final Project project = mockMappingProject(ImmutableList.of(1, 0), 2);
final DruidRel<?> rel = mockDruidRel(DruidJoinQueryRel.class, PartialDruidQuery.Stage.SELECT_PROJECT, null, project, null);
Assert.assertTrue(DruidRels.isScanOrMapping(rel, true));
Assert.assertFalse(DruidRels.isScanOrMapping(rel, false));
EasyMock.verify(rel, rel.getPartialDruidQuery(), project);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Project in project druid by druid-io.
the class DruidRelsTest method test_isScanOrMapping_mappingUnion.
@Test
public void test_isScanOrMapping_mappingUnion() {
final Project project = mockMappingProject(ImmutableList.of(1, 0), 2);
final DruidRel<?> rel = mockDruidRel(DruidUnionDataSourceRel.class, PartialDruidQuery.Stage.SELECT_PROJECT, null, project, null);
Assert.assertTrue(DruidRels.isScanOrMapping(rel, true));
Assert.assertFalse(DruidRels.isScanOrMapping(rel, false));
EasyMock.verify(rel, rel.getPartialDruidQuery(), project);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Project in project beam by apache.
the class IOPushDownRuleTest method testIsProjectRenameOnlyProgram.
@Test
public void testIsProjectRenameOnlyProgram() {
List<Pair<Pair<String, Boolean>, Boolean>> tests = ImmutableList.of(// Selecting fields in a different order is only allowed with project push-down.
Pair.of(Pair.of("select unused2, name, id from TEST", true), true), Pair.of(Pair.of("select unused2, name, id from TEST", false), false), Pair.of(Pair.of("select id from TEST", false), true), Pair.of(Pair.of("select * from TEST", false), true), Pair.of(Pair.of("select id, name from TEST", false), true), Pair.of(Pair.of("select id+10 from TEST", false), false), // Note that we only care about projects.
Pair.of(Pair.of("select id from TEST where name='one'", false), true));
for (Pair<Pair<String, Boolean>, Boolean> test : tests) {
String sqlQuery = test.left.left;
boolean projectPushDownSupported = test.left.right;
boolean expectedAnswer = test.right;
BeamRelNode basicRel = sqlEnv.parseQuery(sqlQuery);
assertThat(basicRel, instanceOf(Calc.class));
Calc calc = (Calc) basicRel;
assertThat(test.toString(), BeamIOPushDownRule.INSTANCE.isProjectRenameOnlyProgram(calc.getProgram(), projectPushDownSupported), equalTo(expectedAnswer));
}
}
Aggregations