当前位置: 首页>>代码示例>>Java>>正文


Java RelOptRuleCall.rel方法代码示例

本文整理汇总了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());
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:20,代码来源:DrillAggregateRule.java

示例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);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:22,代码来源:WriterPrule.java

示例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;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:17,代码来源:PruneScanRuleBase.java

示例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);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:20,代码来源:ElasticScanPrule.java

示例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;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:HBasePushFilterIntoScan.java

示例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;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:44,代码来源:ConvertHiveParquetScanToDrillParquetScan.java

示例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()));
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:10,代码来源:DrillProjectRule.java

示例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);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:12,代码来源:PushProjectForFlattenPastProjectRule.java

示例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;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:12,代码来源:ProjectRule.java

示例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;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:13,代码来源:ElasticFilterRule.java

示例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);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:10,代码来源:PushProjectPastFlattenRule.java

示例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;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:9,代码来源:HBasePushFilterIntoScan.java

示例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;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:InfoSchemaPushFilterIntoRecordGenerator.java

示例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()));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:7,代码来源:EmptyPrule.java

示例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);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:InfoSchemaPushFilterIntoRecordGenerator.java


注:本文中的org.apache.calcite.plan.RelOptRuleCall.rel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。