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


Java RelOptUtil.splitJoinCondition方法代码示例

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


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

示例1: apply

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的package包/类
public boolean apply(Join join, JoinRelType joinType, RexNode exp) {
  if (joinType != JoinRelType.INNER) {
    return true;  // In OUTER join, we could not pull-up the filter.
                  // All we can do is keep the filter with JOIN, and
                  // then decide whether the filter could be pushed down
                  // into LEFT/RIGHT.
  }

  List<RexNode> tmpLeftKeys = Lists.newArrayList();
  List<RexNode> tmpRightKeys = Lists.newArrayList();
  List<RelDataTypeField> sysFields = Lists.newArrayList();

  RexNode remaining = RelOptUtil.splitJoinCondition(sysFields, join.getLeft(), join.getRight(), exp, tmpLeftKeys, tmpRightKeys, null, null);

  if (remaining.isAlwaysTrue()) {
    return true;
  }

  return false;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:21,代码来源:DrillFilterJoinRules.java

示例2: apply

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的package包/类
public boolean apply(Join join, JoinRelType joinType, RexNode exp) {
  if (joinType != JoinRelType.INNER) {
    return true;  // In OUTER join, we could not pull-up the filter.
                  // All we can do is keep the filter with JOIN, and
                  // then decide whether the filter could be pushed down
                  // into LEFT/RIGHT.
  }

  List<RexNode> tmpLeftKeys = Lists.newArrayList();
  List<RexNode> tmpRightKeys = Lists.newArrayList();
  List<RelDataTypeField> sysFields = Lists.newArrayList();
  List<Integer> filterNulls = Lists.newArrayList();

  RexNode remaining = RelOptUtil.splitJoinCondition(sysFields, join.getLeft(), join.getRight(),
      exp, tmpLeftKeys, tmpRightKeys, filterNulls, null);

  return remaining.isAlwaysTrue();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:19,代码来源:FilterJoinRulesUtil.java

示例3: getJoinCategory

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的package包/类
public static JoinCategory getJoinCategory(RelNode left, RelNode right, RexNode condition,
    List<Integer> leftKeys, List<Integer> rightKeys, List<Boolean> filterNulls) {
  if (condition.isAlwaysTrue()) {
    return JoinCategory.CARTESIAN;
  }
  leftKeys.clear();
  rightKeys.clear();
  filterNulls.clear();
  RexNode remaining = RelOptUtil.splitJoinCondition(left, right, condition, leftKeys, rightKeys, filterNulls);

  if (!remaining.isAlwaysTrue() || (leftKeys.size() == 0 || rightKeys.size() == 0) ) {
    // for practical purposes these cases could be treated as inequality
    return JoinCategory.INEQUALITY;
  }
  return JoinCategory.EQUALITY;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:17,代码来源:JoinUtils.java

示例4: apply

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的package包/类
public boolean apply(Join join, JoinRelType joinType, RexNode exp) {
  if (joinType != JoinRelType.INNER) {
    return true;  // In OUTER join, we could not pull-up the filter.
                  // All we can do is keep the filter with JOIN, and
                  // then decide whether the filter could be pushed down
                  // into LEFT/RIGHT.
  }

  List<RexNode> tmpLeftKeys = Lists.newArrayList();
  List<RexNode> tmpRightKeys = Lists.newArrayList();
  List<RelDataTypeField> sysFields = Lists.newArrayList();
  List<Integer> filterNulls = Lists.newArrayList();

  RexNode remaining = RelOptUtil.splitJoinCondition(sysFields, join.getLeft(), join.getRight(), exp, tmpLeftKeys, tmpRightKeys, filterNulls, null);

  if (remaining.isAlwaysTrue()) {
    return true;
  }

  return false;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:22,代码来源:DrillFilterJoinRules.java

示例5: getPigJoinStatement

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的package包/类
/**
 * Constructs a Pig JOIN statement in the form of
 * <pre>
 * {@code
 * A = JOIN A BY f1 LEFT OUTER, B BY f2;
 * }
 * </pre>
 * Only supports simple equi-joins with single column on both sides of
 * <code>=</code>.
 */
private String getPigJoinStatement(Implementor implementor) {
  if (!getCondition().isA(SqlKind.EQUALS)) {
    throw new IllegalArgumentException("Only equi-join are supported");
  }
  List<RexNode> operands = ((RexCall) getCondition()).getOperands();
  if (operands.size() != 2) {
    throw new IllegalArgumentException("Only equi-join are supported");
  }
  List<Integer> leftKeys = new ArrayList<>(1);
  List<Integer> rightKeys = new ArrayList<>(1);
  List<Boolean> filterNulls = new ArrayList<>(1);
  RelOptUtil.splitJoinCondition(getLeft(), getRight(), getCondition(), leftKeys, rightKeys,
      filterNulls);

  String leftRelAlias = implementor.getPigRelationAlias((PigRel) getLeft());
  String rightRelAlias = implementor.getPigRelationAlias((PigRel) getRight());
  String leftJoinFieldName = implementor.getFieldName((PigRel) getLeft(), leftKeys.get(0));
  String rightJoinFieldName = implementor.getFieldName((PigRel) getRight(), rightKeys.get(0));

  return implementor.getPigRelationAlias((PigRel) getLeft()) + " = JOIN " + leftRelAlias + " BY "
      + leftJoinFieldName + ' ' + getPigJoinType() + ", " + rightRelAlias + " BY "
      + rightJoinFieldName + ';';
}
 
开发者ID:apache,项目名称:calcite,代码行数:34,代码来源:PigJoin.java

示例6: of

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的package包/类
/** Creates a {@code JoinInfo} by analyzing a condition. */
public static JoinInfo of(RelNode left, RelNode right, RexNode condition) {
  final List<Integer> leftKeys = new ArrayList<Integer>();
  final List<Integer> rightKeys = new ArrayList<Integer>();
  final List<Boolean> filterNulls = new ArrayList<Boolean>();
  RexNode remaining =
      RelOptUtil.splitJoinCondition(left, right, condition, leftKeys,
          rightKeys, filterNulls);
  if (remaining.isAlwaysTrue()) {
    return new EquiJoinInfo(ImmutableIntList.copyOf(leftKeys),
        ImmutableIntList.copyOf(rightKeys));
  } else {
    return new NonEquiJoinInfo(ImmutableIntList.copyOf(leftKeys),
        ImmutableIntList.copyOf(rightKeys), remaining);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:JoinInfo.java

示例7: testSplitJoinCondition

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的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

示例8: checkCartesianJoin

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的package包/类
/**
   * Check if the given RelNode contains any Cartesian join.
   * Return true if find one. Otherwise, return false.
   *
   * @param relNode   the RelNode to be inspected.
   * @param leftKeys  a list used for the left input into the join which has
   *                  equi-join keys. It can be empty or not (but not null),
   *                  this method will clear this list before using it.
   * @param rightKeys a list used for the right input into the join which has
   *                  equi-join keys. It can be empty or not (but not null),
   *                  this method will clear this list before using it.
   * @return          Return true if the given relNode contains Cartesian join.
   *                  Otherwise, return false
   */
public static boolean checkCartesianJoin(RelNode relNode, List<Integer> leftKeys, List<Integer> rightKeys) {
  if (relNode instanceof Join) {
    leftKeys.clear();
    rightKeys.clear();

    Join joinRel = (Join) relNode;
    RelNode left = joinRel.getLeft();
    RelNode right = joinRel.getRight();

    RexNode remaining = RelOptUtil.splitJoinCondition(left, right, joinRel.getCondition(), leftKeys, rightKeys);
    if(joinRel.getJoinType() == JoinRelType.INNER) {
      if(leftKeys.isEmpty() || rightKeys.isEmpty()) {
        return true;
      }
    } else {
      if(!remaining.isAlwaysTrue() || leftKeys.isEmpty() || rightKeys.isEmpty()) {
        return true;
      }
    }
  }

  for (RelNode child : relNode.getInputs()) {
    if(checkCartesianJoin(child, leftKeys, rightKeys)) {
      return true;
    }
  }

  return false;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:44,代码来源:JoinUtils.java

示例9: getJoinCategory

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的package包/类
public static JoinCategory getJoinCategory(RelNode left, RelNode right, RexNode condition,
    List<Integer> leftKeys, List<Integer> rightKeys) {
  if (condition.isAlwaysTrue()) {
    return JoinCategory.CARTESIAN;
  }
  leftKeys.clear();
  rightKeys.clear();
  RexNode remaining = RelOptUtil.splitJoinCondition(left, right, condition, leftKeys, rightKeys);

  if (!remaining.isAlwaysTrue() || (leftKeys.size() == 0 || rightKeys.size() == 0) ) {
    // for practical purposes these cases could be treated as inequality
    return JoinCategory.INEQUALITY;
  }
  return JoinCategory.EQUALITY;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:JoinUtils.java

示例10: checkCartesianJoin

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的package包/类
/**
   * Check if the given RelNode contains any Cartesian join.
   * Return true if find one. Otherwise, return false.
   *
   * @param relNode   the RelNode to be inspected.
   * @param leftKeys  a list used for the left input into the join which has
   *                  equi-join keys. It can be empty or not (but not null),
   *                  this method will clear this list before using it.
   * @param rightKeys a list used for the right input into the join which has
   *                  equi-join keys. It can be empty or not (but not null),
   *                  this method will clear this list before using it.
   * @param filterNulls   The join key positions for which null values will not
   *                      match. null values only match for the "is not distinct
   *                      from" condition.
   * @return          Return true if the given relNode contains Cartesian join.
   *                  Otherwise, return false
   */
public static boolean checkCartesianJoin(RelNode relNode, List<Integer> leftKeys, List<Integer> rightKeys, List<Boolean> filterNulls) {
  if (relNode instanceof Join) {
    leftKeys.clear();
    rightKeys.clear();

    Join joinRel = (Join) relNode;
    RelNode left = joinRel.getLeft();
    RelNode right = joinRel.getRight();

    RexNode remaining = RelOptUtil.splitJoinCondition(left, right, joinRel.getCondition(), leftKeys, rightKeys, filterNulls);
    if(joinRel.getJoinType() == JoinRelType.INNER) {
      if(leftKeys.isEmpty() || rightKeys.isEmpty()) {
        return true;
      }
    } else {
      if(!remaining.isAlwaysTrue() || leftKeys.isEmpty() || rightKeys.isEmpty()) {
        return true;
      }
    }
  }

  for (RelNode child : relNode.getInputs()) {
    if(checkCartesianJoin(child, leftKeys, rightKeys, filterNulls)) {
      return true;
    }
  }

  return false;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:47,代码来源:JoinUtils.java

示例11: checkCartesianJoin

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的package包/类
/**
   * Check if the given RelNode contains any Cartesian join.
   * Return true if find one. Otherwise, return false.
   *
   * @param relNode     the RelNode to be inspected.
   * @param leftKeys    a list used for the left input into the join which has
   *                    equi-join keys. It can be empty or not (but not null),
   *                    this method will clear this list before using it.
   * @param rightKeys   a list used for the right input into the join which has
   *                    equi-join keys. It can be empty or not (but not null),
   *                    this method will clear this list before using it.
   * @param filterNulls The join key positions for which null values will not
   *                    match.
   * @return            Return true if the given relNode contains Cartesian join.
   *                    Otherwise, return false
   */
public static boolean checkCartesianJoin(RelNode relNode, List<Integer> leftKeys, List<Integer> rightKeys, List<Boolean> filterNulls) {
  if (relNode instanceof Join) {
    leftKeys.clear();
    rightKeys.clear();

    Join joinRel = (Join) relNode;
    RelNode left = joinRel.getLeft();
    RelNode right = joinRel.getRight();

    RexNode remaining = RelOptUtil.splitJoinCondition(left, right, joinRel.getCondition(), leftKeys, rightKeys, filterNulls);
    if (joinRel.getJoinType() == JoinRelType.INNER) {
      if (leftKeys.isEmpty() || rightKeys.isEmpty()) {
        return true;
      }
    } else {
      if (!remaining.isAlwaysTrue() || leftKeys.isEmpty() || rightKeys.isEmpty()) {
        return true;
      }
    }
  }

  for (RelNode child : relNode.getInputs()) {
    if (checkCartesianJoin(child, leftKeys, rightKeys, filterNulls)) {
      return true;
    }
  }

  return false;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:46,代码来源:JoinUtils.java

示例12: visit

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的package包/类
@Override
public RelInfo visit(RelContext context, RelNode node, List<RelInfo> inputStreams)
{
  Join join = (Join)node;
  if (inputStreams.size() != 2) {
    throw new UnsupportedOperationException("Join is a BiRel");
  }

  if ((join.getJoinType() == JoinRelType.FULL) || (join.getJoinType() == JoinRelType.LEFT) ||
      (join.getJoinType() == JoinRelType.RIGHT)) {
    throw new UnsupportedOperationException("Outer joins are not supported");
  }

  final List<Integer> leftKeys = new ArrayList<>();
  final List<Integer> rightKeys = new ArrayList<>();

  RexNode remaining =
      RelOptUtil.splitJoinCondition(join.getLeft(), join.getRight(), join.getCondition(), leftKeys, rightKeys);

  if (leftKeys.size() != rightKeys.size()) {
    throw new RuntimeException("Unexpected condition reached. Left and right condition count should be same");
  }

  if (leftKeys.size() == 0) {
    throw new UnsupportedOperationException("Theta joins are not supported.");
  }

  RelInfo relInfo = addInnerJoinOperator(join, leftKeys, rightKeys, context);

  if (!remaining.isAlwaysTrue()) {
    relInfo = addJoinFilter(join, remaining, relInfo, context);
  }

  return relInfo;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:36,代码来源:ApexRelNode.java

示例13: NestedLoopJoinPrel

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的package包/类
public NestedLoopJoinPrel(RelOptCluster cluster, RelTraitSet traits, RelNode left, RelNode right, RexNode condition,
                    JoinRelType joinType) throws InvalidRelException {
  super(cluster, traits, left, right, condition, joinType);
  RelOptUtil.splitJoinCondition(left, right, condition, leftKeys, rightKeys);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:NestedLoopJoinPrel.java

示例14: NestedLoopJoinPrel

import org.apache.calcite.plan.RelOptUtil; //导入方法依赖的package包/类
public NestedLoopJoinPrel(RelOptCluster cluster, RelTraitSet traits, RelNode left, RelNode right, RexNode condition,
                    JoinRelType joinType) throws InvalidRelException {
  super(cluster, traits, left, right, condition, joinType);
  RelOptUtil.splitJoinCondition(left, right, condition, leftKeys, rightKeys, filterNulls);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:6,代码来源:NestedLoopJoinPrel.java


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