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


Java ConverterRule.getOutTrait方法代码示例

本文整理汇总了Java中org.apache.calcite.rel.convert.ConverterRule.getOutTrait方法的典型用法代码示例。如果您正苦于以下问题:Java ConverterRule.getOutTrait方法的具体用法?Java ConverterRule.getOutTrait怎么用?Java ConverterRule.getOutTrait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.calcite.rel.convert.ConverterRule的用法示例。


在下文中一共展示了ConverterRule.getOutTrait方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerConverterRule

import org.apache.calcite.rel.convert.ConverterRule; //导入方法依赖的package包/类
public void registerConverterRule(
    RelOptPlanner planner,
    ConverterRule converterRule) {
  if (converterRule.isGuaranteed()) {
    ConversionData conversionData = getConversionData(planner);

    final Convention inConvention =
        (Convention) converterRule.getInTrait();
    final Convention outConvention =
        (Convention) converterRule.getOutTrait();
    conversionData.conversionGraph.addVertex(inConvention);
    conversionData.conversionGraph.addVertex(outConvention);
    conversionData.conversionGraph.addEdge(inConvention, outConvention);

    conversionData.mapArcToConverterRule.put(
        Pair.of(inConvention, outConvention), converterRule);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:ConventionTraitDef.java

示例2: doesConverterApply

import org.apache.calcite.rel.convert.ConverterRule; //导入方法依赖的package包/类
private boolean doesConverterApply(
    ConverterRule converterRule,
    HepRelVertex vertex) {
  RelTrait outTrait = converterRule.getOutTrait();
  List<HepRelVertex> parents = Graphs.predecessorListOf(graph, vertex);
  for (HepRelVertex parent : parents) {
    RelNode parentRel = parent.getCurrentRel();
    if (parentRel instanceof Converter) {
      // We don't support converter chains.
      continue;
    }
    if (parentRel.getTraitSet().contains(outTrait)) {
      // This parent wants the traits produced by the converter.
      return true;
    }
  }
  return (vertex == root)
      && (requestedRootTraits != null)
      && requestedRootTraits.contains(outTrait);
}
 
开发者ID:apache,项目名称:calcite,代码行数:21,代码来源:HepPlanner.java

示例3: registerConverterRule

import org.apache.calcite.rel.convert.ConverterRule; //导入方法依赖的package包/类
public void registerConverterRule(
    RelOptPlanner planner,
    ConverterRule converterRule) {
  if (!converterRule.isGuaranteed()) {
    return;
  }

  RelTrait fromTrait = converterRule.getInTrait();
  RelTrait toTrait = converterRule.getOutTrait();

  conversionMap.put(fromTrait, Pair.of(toTrait, converterRule));
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:VolcanoPlannerTraitTest.java

示例4: applyRule

import org.apache.calcite.rel.convert.ConverterRule; //导入方法依赖的package包/类
private HepRelVertex applyRule(
    RelOptRule rule,
    HepRelVertex vertex,
    boolean forceConversions) {
  if (!belongsToDag(vertex)) {
    return null;
  }
  RelTrait parentTrait = null;
  List<RelNode> parents = null;
  if (rule instanceof ConverterRule) {
    // Guaranteed converter rules require special casing to make sure
    // they only fire where actually needed, otherwise they tend to
    // fire to infinity and beyond.
    ConverterRule converterRule = (ConverterRule) rule;
    if (converterRule.isGuaranteed() || !forceConversions) {
      if (!doesConverterApply(converterRule, vertex)) {
        return null;
      }
      parentTrait = converterRule.getOutTrait();
    }
  } else if (rule instanceof CommonRelSubExprRule) {
    // Only fire CommonRelSubExprRules if the vertex is a common
    // subexpression.
    List<HepRelVertex> parentVertices = getVertexParents(vertex);
    if (parentVertices.size() < 2) {
      return null;
    }
    parents = new ArrayList<>();
    for (HepRelVertex pVertex : parentVertices) {
      parents.add(pVertex.getCurrentRel());
    }
  }

  final List<RelNode> bindings = new ArrayList<>();
  final Map<RelNode, List<RelNode>> nodeChildren = new HashMap<>();
  boolean match =
      matchOperands(
          rule.getOperand(),
          vertex.getCurrentRel(),
          bindings,
          nodeChildren);

  if (!match) {
    return null;
  }

  HepRuleCall call =
      new HepRuleCall(
          this,
          rule.getOperand(),
          bindings.toArray(new RelNode[bindings.size()]),
          nodeChildren,
          parents);

  // Allow the rule to apply its own side-conditions.
  if (!rule.matches(call)) {
    return null;
  }

  fireRule(call);

  if (!call.getResults().isEmpty()) {
    return applyTransformationResults(
        vertex,
        call,
        parentTrait);
  }

  return null;
}
 
开发者ID:apache,项目名称:calcite,代码行数:71,代码来源:HepPlanner.java


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