org.apache.calcite.util.Util.equalShallow()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中org.apache.calcite.util.Util.equalShallow()方法的一些代码示例,展示了Util.equalShallow()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.equalShallow()方法的具体详情如下:
包路径:org.apache.calcite.util.Util
类名称:Util
方法名:equalShallow

Util.equalShallow介绍

[英]Returns whether two lists are equal to each other using shallow comparisons.
[中]使用浅比较返回两个列表是否相等。

代码示例

代码示例来源:origin: apache/hive

/** Fallback if none of the other {@code decorrelateRel} methods match. */
public Frame decorrelateRel(RelNode rel) {
 RelNode newRel = rel.copy(rel.getTraitSet(), rel.getInputs());
 if (rel.getInputs().size() > 0) {
  List<RelNode> oldInputs = rel.getInputs();
  List<RelNode> newInputs = Lists.newArrayList();
  for (int i = 0; i < oldInputs.size(); ++i) {
   final Frame frame = getInvoke(oldInputs.get(i), rel);
   if (frame == null || !frame.corDefOutputs.isEmpty()) {
    // if input is not rewritten, or if it produces correlated
    // variables, terminate rewrite
    return null;
   }
   newInputs.add(frame.r);
   newRel.replaceInput(i, frame.r);
  }
  if (!Util.equalShallow(oldInputs, newInputs)) {
   newRel = rel.copy(rel.getTraitSet(), newInputs);
  }
 }
 // the output position should not change since there are no corVars
 // coming from below.
 return register(rel, newRel, identityMap(rel.getRowType().getFieldCount()),
     ImmutableSortedMap.<CorDef, Integer>of());
}

代码示例来源:origin: apache/drill

/** Fallback if none of the other {@code decorrelateRel} methods match. */
public Frame decorrelateRel(RelNode rel) {
 RelNode newRel = rel.copy(rel.getTraitSet(), rel.getInputs());
 if (rel.getInputs().size() > 0) {
  List<RelNode> oldInputs = rel.getInputs();
  List<RelNode> newInputs = Lists.newArrayList();
  for (int i = 0; i < oldInputs.size(); ++i) {
   final Frame frame = getInvoke(oldInputs.get(i), rel);
   if (frame == null || !frame.corDefOutputs.isEmpty()) {
    // if input is not rewritten, or if it produces correlated
    // variables, terminate rewrite
    return null;
   }
   newInputs.add(frame.r);
   newRel.replaceInput(i, frame.r);
  }
  if (!Util.equalShallow(oldInputs, newInputs)) {
   newRel = rel.copy(rel.getTraitSet(), newInputs);
  }
 }
 // the output position should not change since there are no corVars
 // coming from below.
 return register(rel, newRel, identityMap(rel.getRowType().getFieldCount()),
     ImmutableSortedMap.<CorDef, Integer>of());
}

代码示例来源:origin: org.apache.calcite/calcite-core

public RelNode onRegister(RelOptPlanner planner) {
 List<RelNode> oldInputs = getInputs();
 List<RelNode> inputs = new ArrayList<>(oldInputs.size());
 for (final RelNode input : oldInputs) {
  RelNode e = planner.ensureRegistered(input, null);
  if (e != input) {
   // TODO: change 'equal' to 'eq', which is stronger.
   assert RelOptUtil.equal(
     "rowtype of rel before registration",
     input.getRowType(),
     "rowtype of rel after registration",
     e.getRowType(),
     Litmus.THROW);
  }
  inputs.add(e);
 }
 RelNode r = this;
 if (!Util.equalShallow(oldInputs, inputs)) {
  r = copy(getTraitSet(), inputs);
 }
 r.recomputeDigest();
 assert r.isValid(Litmus.THROW, null);
 return r;
}

代码示例来源:origin: com.alibaba.blink/flink-table

/** Fallback if none of the other {@code decorrelateRel} methods match. */
public Frame decorrelateRel(RelNode rel) {
  RelNode newRel = rel.copy(rel.getTraitSet(), rel.getInputs());
  if (rel.getInputs().size() > 0) {
    List<RelNode> oldInputs = rel.getInputs();
    List<RelNode> newInputs = new ArrayList<>();
    for (int i = 0; i < oldInputs.size(); ++i) {
      final Frame frame = getInvoke(oldInputs.get(i));
      if (frame == null || frame.c != null) {
        // if input is not rewritten, or if it produces correlated variables, terminate rewrite
        return null;
      }
      newInputs.add(frame.r);
      newRel.replaceInput(i, frame.r);
    }
    if (!Util.equalShallow(oldInputs, newInputs)) {
      newRel = rel.copy(rel.getTraitSet(), newInputs);
    }
  }
  // the output position should not change since there are no corVars coming from below.
  return new Frame(rel, newRel, null, identityMap(rel.getRowType().getFieldCount()));
}

代码示例来源:origin: Qihoo360/Quicksql

public RelNode onRegister(RelOptPlanner planner) {
 List<RelNode> oldInputs = getInputs();
 List<RelNode> inputs = new ArrayList<>(oldInputs.size());
 for (final RelNode input : oldInputs) {
  RelNode e = planner.ensureRegistered(input, null);
  if (e != input) {
   // TODO: change 'equal' to 'eq', which is stronger.
   assert RelOptUtil.equal(
     "rowtype of rel before registration",
     input.getRowType(),
     "rowtype of rel after registration",
     e.getRowType(),
     Litmus.THROW);
  }
  inputs.add(e);
 }
 RelNode r = this;
 if (!Util.equalShallow(oldInputs, inputs)) {
  r = copy(getTraitSet(), inputs);
 }
 r.recomputeDigest();
 assert r.isValid(Litmus.THROW, null);
 return r;
}

代码示例来源:origin: Qihoo360/Quicksql

/** Fallback if none of the other {@code decorrelateRel} methods match. */
public Frame decorrelateRel(RelNode rel) {
 RelNode newRel = rel.copy(rel.getTraitSet(), rel.getInputs());
 if (rel.getInputs().size() > 0) {
  List<RelNode> oldInputs = rel.getInputs();
  List<RelNode> newInputs = new ArrayList<>();
  for (int i = 0; i < oldInputs.size(); ++i) {
   final Frame frame = getInvoke(oldInputs.get(i), rel);
   if (frame == null || !frame.corDefOutputs.isEmpty()) {
    // if input is not rewritten, or if it produces correlated
    // variables, terminate rewrite
    return null;
   }
   newInputs.add(frame.r);
   newRel.replaceInput(i, frame.r);
  }
  if (!Util.equalShallow(oldInputs, newInputs)) {
   newRel = rel.copy(rel.getTraitSet(), newInputs);
  }
 }
 // the output position should not change since there are no corVars
 // coming from below.
 return register(rel, newRel, identityMap(rel.getRowType().getFieldCount()),
   ImmutableSortedMap.of());
}

代码示例来源:origin: org.apache.calcite/calcite-core

/** Fallback if none of the other {@code decorrelateRel} methods match. */
public Frame decorrelateRel(RelNode rel) {
 RelNode newRel = rel.copy(rel.getTraitSet(), rel.getInputs());
 if (rel.getInputs().size() > 0) {
  List<RelNode> oldInputs = rel.getInputs();
  List<RelNode> newInputs = new ArrayList<>();
  for (int i = 0; i < oldInputs.size(); ++i) {
   final Frame frame = getInvoke(oldInputs.get(i), rel);
   if (frame == null || !frame.corDefOutputs.isEmpty()) {
    // if input is not rewritten, or if it produces correlated
    // variables, terminate rewrite
    return null;
   }
   newInputs.add(frame.r);
   newRel.replaceInput(i, frame.r);
  }
  if (!Util.equalShallow(oldInputs, newInputs)) {
   newRel = rel.copy(rel.getTraitSet(), newInputs);
  }
 }
 // the output position should not change since there are no corVars
 // coming from below.
 return register(rel, newRel, identityMap(rel.getRowType().getFieldCount()),
   ImmutableSortedMap.of());
}

代码示例来源:origin: com.alibaba.blink/flink-table

/** Fallback if none of the other {@code decorrelateRel} methods match. */
public Frame decorrelateRel(RelNode rel) {
  RelNode newRel = rel.copy(rel.getTraitSet(), rel.getInputs());
  if (rel.getInputs().size() > 0) {
    List<RelNode> oldInputs = rel.getInputs();
    List<RelNode> newInputs = Lists.newArrayList();
    for (int i = 0; i < oldInputs.size(); ++i) {
      final Frame frame = getInvoke(oldInputs.get(i), rel);
      if (frame == null || !frame.corDefOutputs.isEmpty()) {
        // if input is not rewritten, or if it produces correlated
        // variables, terminate rewrite
        return null;
      }
      newInputs.add(frame.r);
      newRel.replaceInput(i, frame.r);
    }
    if (!Util.equalShallow(oldInputs, newInputs)) {
      newRel = rel.copy(rel.getTraitSet(), newInputs);
    }
  }
  // the output position should not change since there are no corVars
  // coming from below.
  return register(rel, newRel, identityMap(rel.getRowType().getFieldCount()),
      ImmutableSortedMap.<CorDef, Integer>of());
}

代码示例来源:origin: org.apache.calcite/calcite-core

if (!Util.equalShallow(inputs, newInputs)) {
 RelNode oldRel = rel;
 rel = rel.copy(rel.getTraitSet(), newInputs);

代码示例来源:origin: Qihoo360/Quicksql

if (!Util.equalShallow(inputs, newInputs)) {
 RelNode oldRel = rel;
 rel = rel.copy(rel.getTraitSet(), newInputs);

相关文章