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


Java LogicalProject.getInput方法代码示例

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


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

示例1: testSplitJoinCondition

import org.apache.calcite.rel.logical.LogicalProject; //导入方法依赖的package包/类
/** Test case for
 * <a href="https://issues.apache.org/jira/browse/CALCITE-833">[CALCITE-833]
 * RelOptUtil.splitJoinCondition attempts to split a Join-Condition which
 * has a remaining condition</a>. */
@Test public void testSplitJoinCondition() {
  final String sql = "select * \n"
      + "from emp a \n"
      + "INNER JOIN dept b \n"
      + "ON CAST(a.empno AS int) <> b.deptno";

  final RelNode relNode = toRel(sql);
  final LogicalProject project = (LogicalProject) relNode;
  final LogicalJoin join = (LogicalJoin) project.getInput(0);
  final List<RexNode> leftJoinKeys = new ArrayList<>();
  final List<RexNode> rightJoinKeys = new ArrayList<>();
  final ArrayList<RelDataTypeField> sysFieldList = new ArrayList<>();
  final RexNode remaining = RelOptUtil.splitJoinCondition(sysFieldList,
      join.getInputs().get(0),
      join.getInputs().get(1),
      join.getCondition(),
      leftJoinKeys,
      rightJoinKeys,
      null,
      null);

  assertThat(remaining.toString(), is("<>(CAST($0):INTEGER NOT NULL, $9)"));
  assertThat(leftJoinKeys.isEmpty(), is(true));
  assertThat(rightJoinKeys.isEmpty(), is(true));
}
 
开发者ID:apache,项目名称:calcite,代码行数:30,代码来源:RexTransformerTest.java

示例2: onMatch

import org.apache.calcite.rel.logical.LogicalProject; //导入方法依赖的package包/类
public void onMatch(RelOptRuleCall call) {
  final LogicalProject project = call.rel(0);
  final RelNode input = project.getInput();
  final RexProgram program =
      RexProgram.create(
          input.getRowType(),
          project.getProjects(),
          null,
          project.getRowType(),
          project.getCluster().getRexBuilder());
  final LogicalCalc calc = LogicalCalc.create(input, program);
  call.transformTo(calc);
}
 
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:ProjectToCalcRule.java

示例3: onMatch

import org.apache.calcite.rel.logical.LogicalProject; //导入方法依赖的package包/类
public void onMatch(RelOptRuleCall call) {
  final LogicalProject project = call.rel(0);
  RelNode childRel = project.getInput();
  call.transformTo(
      new PhysLeafRel(
          childRel.getCluster(),
          "b"));
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:VolcanoPlannerTest.java

示例4: decorrelateRel

import org.apache.calcite.rel.logical.LogicalProject; //导入方法依赖的package包/类
/**
 * Rewrite LogicalProject.
 *
 * @param rel the project rel to rewrite
 */
public Frame decorrelateRel(LogicalProject rel) {
	//
	// Rewrite logic:
	//
	// 1. Pass along any correlated variables coming from the input.
	//

	final RelNode oldInput = rel.getInput();
	Frame frame = getInvoke(oldInput, rel);
	if (frame == null) {
		// If input has not been rewritten, do not rewrite this rel.
		return null;
	}
	final List<RexNode> oldProjects = rel.getProjects();
	final List<RelDataTypeField> relOutput = rel.getRowType().getFieldList();

	// LogicalProject projects the original expressions,
	// plus any correlated variables the input wants to pass along.
	final List<Pair<RexNode, String>> projects = Lists.newArrayList();

	// If this LogicalProject has correlated reference, create value generator
	// and produce the correlated variables in the new output.
	if (cm.mapRefRelToCorVar.containsKey(rel)) {
		decorrelateInputWithValueGenerator(rel);

		// The old input should be mapped to the LogicalJoin created by
		// rewriteInputWithValueGenerator().
		frame = map.get(oldInput);
	}

	// LogicalProject projects the original expressions
	final Map<Integer, Integer> mapOldToNewOutputPos = Maps.newHashMap();
	int newPos;
	for (newPos = 0; newPos < oldProjects.size(); newPos++) {
		projects.add(newPos, Pair.of(decorrelateExpr(oldProjects.get(newPos)), relOutput.get(newPos).getName()));
		mapOldToNewOutputPos.put(newPos, newPos);
	}

	// Project any correlated variables the input wants to pass along.
	final SortedMap<Correlation, Integer> mapCorVarToOutputPos = new TreeMap<>();
	for (Map.Entry<Correlation, Integer> entry : frame.corVarOutputPos.entrySet()) {
		projects.add(RexInputRef.of2(entry.getValue(), frame.r.getRowType().getFieldList()));
		mapCorVarToOutputPos.put(entry.getKey(), newPos);
		newPos++;
	}

	RelNode newProject = RelOptUtil.createProject(frame.r, projects, false);

	return register(rel, newProject, mapOldToNewOutputPos, mapCorVarToOutputPos);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:56,代码来源:FlinkRelDecorrelator.java

示例5: convert

import org.apache.calcite.rel.logical.LogicalProject; //导入方法依赖的package包/类
public RelNode convert(RelNode rel) {
  final LogicalProject project = (LogicalProject) rel;
  final RelTraitSet traitSet = project.getTraitSet().replace(PigRel.CONVENTION);
  return new PigProject(project.getCluster(), traitSet, project.getInput(),
      project.getProjects(), project.getRowType());
}
 
开发者ID:apache,项目名称:calcite,代码行数:7,代码来源:PigRules.java

示例6: decorrelateRel

import org.apache.calcite.rel.logical.LogicalProject; //导入方法依赖的package包/类
/**
 * Rewrite LogicalProject.
 *
 * @param rel the project rel to rewrite
 */
public Frame decorrelateRel(LogicalProject rel) {
  //
  // Rewrite logic:
  //
  // 1. Pass along any correlated variables coming from the input.
  //

  final RelNode oldInput = rel.getInput();
  Frame frame = getInvoke(oldInput, rel);
  if (frame == null) {
    // If input has not been rewritten, do not rewrite this rel.
    return null;
  }
  final List<RexNode> oldProjects = rel.getProjects();
  final List<RelDataTypeField> relOutput = rel.getRowType().getFieldList();

  // Project projects the original expressions,
  // plus any correlated variables the input wants to pass along.
  final List<Pair<RexNode, String>> projects = Lists.newArrayList();

  // If this Project has correlated reference, create value generator
  // and produce the correlated variables in the new output.
  if (cm.mapRefRelToCorRef.containsKey(rel)) {
    frame = decorrelateInputWithValueGenerator(rel, frame);
  }

  // Project projects the original expressions
  final Map<Integer, Integer> mapOldToNewOutputs = new HashMap<>();
  int newPos;
  for (newPos = 0; newPos < oldProjects.size(); newPos++) {
    projects.add(
        newPos,
        Pair.of(
            decorrelateExpr(currentRel, map, cm, oldProjects.get(newPos)),
            relOutput.get(newPos).getName()));
    mapOldToNewOutputs.put(newPos, newPos);
  }

  // Project any correlated variables the input wants to pass along.
  final SortedMap<CorDef, Integer> corDefOutputs = new TreeMap<>();
  for (Map.Entry<CorDef, Integer> entry : frame.corDefOutputs.entrySet()) {
    projects.add(
        RexInputRef.of2(entry.getValue(),
            frame.r.getRowType().getFieldList()));
    corDefOutputs.put(entry.getKey(), newPos);
    newPos++;
  }

  RelNode newProject =
      RelOptUtil.createProject(frame.r, projects, false);

  return register(rel, newProject, mapOldToNewOutputs, corDefOutputs);
}
 
开发者ID:apache,项目名称:calcite,代码行数:59,代码来源:RelDecorrelator.java


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