本文整理汇总了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);
}
}
示例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);
}
示例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));
}
示例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;
}