本文整理汇总了Java中org.apache.calcite.plan.RelOptRuleCall.rel方法的典型用法代码示例。如果您正苦于以下问题:Java RelOptRuleCall.rel方法的具体用法?Java RelOptRuleCall.rel怎么用?Java RelOptRuleCall.rel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.plan.RelOptRuleCall
的用法示例。
在下文中一共展示了RelOptRuleCall.rel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMatch
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
final LogicalAggregate aggregate = (LogicalAggregate) call.rel(0);
final RelNode input = call.rel(1);
if (aggregate.containsDistinctCall()) {
// currently, don't use this rule if any of the aggregates contains DISTINCT
return;
}
final RelTraitSet traits = aggregate.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
try {
call.transformTo(new DrillAggregateRel(aggregate.getCluster(), traits, convertedInput, aggregate.indicator,
aggregate.getGroupSet(), aggregate.getGroupSets(), aggregate.getAggCallList()));
} catch (InvalidRelException e) {
tracer.warning(e.toString());
}
}
示例2: onMatch
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
final DrillWriterRel writer = call.rel(0);
final RelNode input = call.rel(1);
final List<Integer> keys = writer.getPartitionKeys();
final RelCollation collation = getCollation(keys);
final boolean hashDistribute = PrelUtil.getPlannerSettings(call.getPlanner()).getOptions().getOption(ExecConstants.CTAS_PARTITIONING_HASH_DISTRIBUTE_VALIDATOR);
final RelTraitSet traits = hashDistribute ?
input.getTraitSet().plus(Prel.DRILL_PHYSICAL).plus(collation).plus(getDistribution(keys)) :
input.getTraitSet().plus(Prel.DRILL_PHYSICAL).plus(collation);
final RelNode convertedInput = convert(input, traits);
if (!new WriteTraitPull(call).go(writer, convertedInput)) {
DrillWriterRelBase newWriter = new WriterPrel(writer.getCluster(), convertedInput.getTraitSet(),
convertedInput, writer.getCreateTableEntry());
call.transformTo(newWriter);
}
}
示例3: matches
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public boolean matches(RelOptRuleCall call) {
final ScanRelBase scan = call.rel(1);
if (scan.getPluginId().getType().equals(pluginType)) {
try {
if(scan.getTableMetadata().getSplitRatio() == 1.0d){
final List<String> partitionColumns = scan.getTableMetadata().getReadDefinition().getPartitionColumnsList();
return partitionColumns != null && !partitionColumns.isEmpty();
}
} catch (NamespaceException e) {
logger.warn("Unable to calculate split.", e);
return false;
}
}
return false;
}
示例4: onMatch
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
ElasticsearchScanDrel logicalScan = call.rel(0);
ElasticIntermediateScanPrel physicalScan = new ElasticIntermediateScanPrel(
logicalScan.getCluster(),
logicalScan.getTraitSet().replace(Prel.PHYSICAL),
logicalScan.getTable(),
logicalScan.getTableMetadata(),
logicalScan.getProjectedColumns(),
logicalScan.getObservedRowcountAdjustment()
);
RelNode converted = new ElasticsearchIntermediatePrel(
physicalScan.getTraitSet(),
physicalScan,
lookupContext);
call.transformTo(converted);
}
示例5: matches
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public boolean matches(RelOptRuleCall call) {
final ScanPrel scan = (ScanPrel) call.rel(2);
if (scan.getGroupScan() instanceof HBaseGroupScan) {
return super.matches(call);
}
return false;
}
示例6: matches
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
/**
* Rule is matched when all of the following match:
* 1) GroupScan in given DrillScalRel is an {@link HiveScan}
* 2) {@link HiveScan} is not already rewritten using Drill's native readers
* 3) InputFormat in Hive table metadata and all partitions metadata contains the same value
* {@link MapredParquetInputFormat}
* 4) No error occurred while checking for the above conditions. An error is logged as warning.
*
* @param call
* @return True if the rule can be applied. False otherwise
*/
@Override
public boolean matches(RelOptRuleCall call) {
final DrillScanRel scanRel = (DrillScanRel) call.rel(0);
final PlannerSettings settings = PrelUtil.getPlannerSettings(call.getPlanner());
if (!(scanRel.getGroupScan() instanceof HiveScan) || ((HiveScan) scanRel.getGroupScan()).isNativeReader()) {
return false;
}
final HiveScan hiveScan = (HiveScan) scanRel.getGroupScan();
final Table hiveTable = hiveScan.hiveReadEntry.getTable();
final Class<? extends InputFormat> tableInputFormat = getInputFormatFromSD(hiveTable, hiveTable.getSd());
if (tableInputFormat == null || !tableInputFormat.equals(MapredParquetInputFormat.class)) {
return false;
}
final List<HivePartition> partitions = hiveScan.hiveReadEntry.getHivePartitionWrappers();
if (partitions == null) {
return true;
}
// Make sure all partitions have the same input format as the table input format
for (HivePartition partition : partitions) {
Class<? extends InputFormat> inputFormat = getInputFormatFromSD(hiveTable, partition.getPartition().getSd());
if (inputFormat == null || !inputFormat.equals(tableInputFormat)) {
return false;
}
}
return true;
}
示例7: onMatch
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
final Project project = (Project) call.rel(0);
final RelNode input = project.getInput();
final RelTraitSet traits = project.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
call.transformTo(new DrillProjectRel(project.getCluster(), traits, convertedInput, project.getProjects(), project
.getRowType()));
}
示例8: onMatch
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
ProjectForFlattenRel projectForFlattenRel = call.rel(0);
ProjectRel project = call.rel(1);
List<RexNode> newItemsExprs = RelOptUtil.pushPastProject(projectForFlattenRel.getItemExprs(), project);
List<RexNode> newProjExprs = RelOptUtil.pushPastProject(projectForFlattenRel.getProjExprs(), project);
ProjectForFlattenRel newProjectForFlattenRel = new ProjectForFlattenRel(
projectForFlattenRel.getCluster(), projectForFlattenRel.getTraitSet(), project.getInput(), projectForFlattenRel.getRowType(), newProjExprs, newItemsExprs);
call.transformTo(newProjectForFlattenRel);
}
示例9: matches
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public boolean matches(RelOptRuleCall call) {
// this cannot operate on a project that has a flatten in it.
final Project project = call.rel(0);
for (RexNode e : project.getChildExps()) {
if (FlattenVisitors.hasFlatten(e)) {
return false;
}
}
return true;
}
示例10: matches
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public boolean matches(RelOptRuleCall call) {
final FilterPrel filter = call.rel(0);
final ElasticsearchIntermediatePrel intermediatePrel = call.rel(1);
if (intermediatePrel.hasTerminalPrel()) {
return false;
}
// more checking will be done in onmatch.
return true;
}
示例11: onMatch
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
final ProjectRel project = call.rel(0);
final FlattenRel flatten = call.rel(1);
RelNode newProjectRel = getProjectForFlattenParam(project, flatten);
if (newProjectRel != null) {
call.transformTo(newProjectRel);
}
}
示例12: matches
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public boolean matches(RelOptRuleCall call) {
final OldScanPrel scan = (OldScanPrel) call.rel(2);
if (scan.getGroupScan() instanceof HBaseGroupScan) {
return super.matches(call);
}
return false;
}
示例13: matches
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public boolean matches(RelOptRuleCall call) {
final ScanPrel scan = (ScanPrel) call.rel(2);
GroupScan groupScan = scan.getGroupScan();
return groupScan instanceof InfoSchemaGroupScan;
}
示例14: onMatch
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
final EmptyRel empty = call.rel(0);
final RelTraitSet traits = empty.getTraitSet().plus(Prel.PHYSICAL);
call.transformTo(new EmptyPrel(empty.getCluster(), traits, empty.getRowType(), empty.getSchema()));
}
示例15: onMatch
import org.apache.calcite.plan.RelOptRuleCall; //导入方法依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
final FilterPrel filterRel = (FilterPrel) call.rel(0);
final ScanPrel scanRel = (ScanPrel) call.rel(1);
doMatch(call, scanRel, null, filterRel);
}