use of org.apache.calcite.rel.core.Project in project flink by apache.
the class HiveParserDMLHelper method replaceDistForStaticParts.
private RelNode replaceDistForStaticParts(LogicalDistribution hiveDist, Table destTable, Map<String, String> staticPartSpec, Map<String, RelDataType> targetColToType) {
Project project = (Project) hiveDist.getInput();
RelNode expandedProject = replaceProjectForStaticPart(project, staticPartSpec, destTable, targetColToType);
hiveDist.replaceInput(0, null);
final int toShift = staticPartSpec.size();
final int numDynmPart = destTable.getTTable().getPartitionKeys().size() - toShift;
return LogicalDistribution.create(expandedProject, shiftRelCollation(hiveDist.getCollation(), project, toShift, numDynmPart), shiftDistKeys(hiveDist.getDistKeys(), project, toShift, numDynmPart));
}
use of org.apache.calcite.rel.core.Project in project flink by apache.
the class HiveParserDMLHelper method addTypeConversions.
static RelNode addTypeConversions(RexBuilder rexBuilder, RelNode queryRelNode, List<RelDataType> targetCalcTypes, List<TypeInfo> targetHiveTypes, SqlFunctionConverter funcConverter) throws SemanticException {
if (queryRelNode instanceof Project) {
return replaceProjectForTypeConversion(rexBuilder, (Project) queryRelNode, targetCalcTypes, targetHiveTypes, funcConverter);
} else {
// current node is not Project, we search for it in inputs
RelNode newInput = addTypeConversions(rexBuilder, queryRelNode.getInput(0), targetCalcTypes, targetHiveTypes, funcConverter);
queryRelNode.replaceInput(0, newInput);
return queryRelNode;
}
}
use of org.apache.calcite.rel.core.Project in project druid by druid-io.
the class DruidRelsTest method test_isScanOrMapping_mapping.
@Test
public void test_isScanOrMapping_mapping() {
final Project project = mockMappingProject(ImmutableList.of(1, 0), 2);
final DruidRel<?> rel = mockDruidRel(DruidQueryRel.class, PartialDruidQuery.Stage.SELECT_PROJECT, null, project, null);
Assert.assertTrue(DruidRels.isScanOrMapping(rel, true));
Assert.assertTrue(DruidRels.isScanOrMapping(rel, false));
EasyMock.verify(rel, rel.getPartialDruidQuery(), project);
}
use of 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.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);
}
Aggregations