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


Java RexShuttle.apply方法代码示例

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


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

示例1: shuttleReferences

import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
/**
 * Replaces all the input references by the position in the
 * input column set. If a reference index cannot be found in
 * the input set, then we return null.
 */
private static RexNode shuttleReferences(final RexBuilder rexBuilder,
    final RexNode node, final Mapping mapping) {
  try {
    RexShuttle visitor =
        new RexShuttle() {
          @Override public RexNode visitInputRef(RexInputRef inputRef) {
            int pos = mapping.getTargetOpt(inputRef.getIndex());
            if (pos != -1) {
              // Found it
              return rexBuilder.makeInputRef(inputRef.getType(), pos);
            }
            throw Util.FoundOne.NULL;
          }
        };
    return visitor.apply(node);
  } catch (Util.FoundOne ex) {
    Util.swallow(ex, null);
    return null;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:26,代码来源:AbstractMaterializedViewRule.java

示例2: accept

import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
public RelNode accept(RexShuttle shuttle) {
  RexNode joinFilter = shuttle.apply(this.joinFilter);
  List<RexNode> outerJoinConditions = shuttle.apply(this.outerJoinConditions);
  RexNode postJoinFilter = shuttle.apply(this.postJoinFilter);

  if (joinFilter == this.joinFilter
      && outerJoinConditions == this.outerJoinConditions
      && postJoinFilter == this.postJoinFilter) {
    return this;
  }

  return new MultiJoin(
      getCluster(),
      inputs,
      joinFilter,
      rowType,
      isFullOuterJoin,
      outerJoinConditions,
      joinTypes,
      projFields,
      joinFieldRefCountsMap,
      postJoinFilter);
}
 
开发者ID:apache,项目名称:calcite,代码行数:24,代码来源:MultiJoin.java

示例3: transformRex

import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
private static List<RexNode> transformRex(
    List<RexNode> nodes,
    final List<RelDataTypeField> oldFields,
    final List<RelDataTypeField> newFields) {
  RexShuttle shuttle = new RexShuttle() {
    @Override public RexNode visitInputRef(RexInputRef ref) {
      RelDataTypeField f = oldFields.get(ref.getIndex());
      for (int index = 0; index < newFields.size(); index++) {
        RelDataTypeField newf = newFields.get(index);
        if (f.getKey().equals(newf.getKey())
            && f.getValue() == newf.getValue()) {
          return new RexInputRef(index, f.getValue());
        }
      }
      throw MatchFailed.INSTANCE;
    }
  };
  return shuttle.apply(nodes);
}
 
开发者ID:apache,项目名称:calcite,代码行数:20,代码来源:MaterializedViewSubstitutionVisitor.java

示例4: apply

import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
public UnifyResult apply(UnifyRuleCall call) {
  final MutableProject target = (MutableProject) call.target;
  final MutableScan query = (MutableScan) call.query;
  // We do not need to check query's parent type to avoid duplication
  // of ProjectToProjectUnifyRule or FilterToProjectUnifyRule, since
  // SubstitutionVisitor performs a top-down match.
  if (!query.equals(target.getInput())) {
    return null;
  }
  final RexShuttle shuttle = getRexShuttle(target);
  final RexBuilder rexBuilder = target.cluster.getRexBuilder();
  final List<RexNode> newProjects;
  try {
    newProjects = (List<RexNode>)
        shuttle.apply(rexBuilder.identityProjects(query.rowType));
  } catch (MatchFailed e) {
    return null;
  }
  final MutableProject newProject =
      MutableProject.of(query.rowType, target, newProjects);
  final MutableRel newProject2 = MutableRels.strip(newProject);
  return call.result(newProject2);
}
 
开发者ID:apache,项目名称:calcite,代码行数:24,代码来源:SubstitutionVisitor.java

示例5: accept

import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
@Override public RelNode accept(RexShuttle shuttle) {
  RexNode condition = shuttle.apply(this.condition);
  if (this.condition == condition) {
    return this;
  }
  return copy(traitSet, condition, left, right, joinType, isSemiJoinDone());
}
 
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:Join.java

示例6: accept

import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
public RelNode accept(RexShuttle shuttle) {
  RexNode condition = shuttle.apply(this.condition);
  if (this.condition == condition) {
    return this;
  }
  return copy(traitSet, getInput(), condition);
}
 
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:Filter.java

示例7: accept

import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
public RelNode accept(RexShuttle shuttle) {
  List<RexNode> exps = shuttle.apply(this.exps);
  if (this.exps == exps) {
    return this;
  }
  return copy(traitSet, getInput(), exps, rowType);
}
 
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:Project.java

示例8: accept

import org.apache.calcite.rex.RexShuttle; //导入方法依赖的package包/类
public RelNode accept(RexShuttle shuttle) {
  RexNode rexCall = shuttle.apply(this.rexCall);
  if (rexCall == this.rexCall) {
    return this;
  }
  return copy(traitSet, inputs, rexCall, elementType, rowType,
      columnMappings);
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:TableFunctionScan.java


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