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


Java Util.FoundOne方法代码示例

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


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

示例1: containsInOperator

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Returns whether a given node contains a {@link SqlInOperator}.
 *
 * @param node a RexNode tree
 */
private static boolean containsInOperator(
	SqlNode node) {
	try {
		SqlVisitor<Void> visitor =
			new SqlBasicVisitor<Void>() {
				public Void visit(SqlCall call) {
					if (call.getOperator() instanceof SqlInOperator) {
						throw new Util.FoundOne(call);
					}
					return super.visit(call);
				}
			};
		node.accept(visitor);
		return false;
	} catch (Util.FoundOne e) {
		Util.swallow(e, null);
		return true;
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:SqlToRelConverter.java

示例2: containsInOperator

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Returns whether a given node contains a {@link SqlInOperator}.
 *
 * @param node a RexNode tree
 */
private static boolean containsInOperator(
    SqlNode node) {
  try {
    SqlVisitor<Void> visitor =
        new SqlBasicVisitor<Void>() {
          public Void visit(SqlCall call) {
            if (call.getOperator() instanceof SqlInOperator) {
              throw new Util.FoundOne(call);
            }
            return super.visit(call);
          }
        };
    node.accept(visitor);
    return false;
  } catch (Util.FoundOne e) {
    Util.swallow(e, null);
    return true;
  }
}
 
开发者ID:apache,项目名称:kylin,代码行数:25,代码来源:SqlToRelConverter.java

示例3: contains

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
public static boolean contains(MutableRel ancestor,
    final MutableRel target) {
  if (ancestor.equals(target)) {
    // Short-cut common case.
    return true;
  }
  try {
    new MutableRelVisitor() {
      @Override public void visit(MutableRel node) {
        if (node.equals(target)) {
          throw Util.FoundOne.NULL;
        }
        super.visit(node);
      }
      // CHECKSTYLE: IGNORE 1
    }.go(ancestor);
    return false;
  } catch (Util.FoundOne e) {
    return true;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:22,代码来源:MutableRels.java

示例4: shuttleReferences

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

示例5: findCorrelationEquivalent

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/** Finds a {@link RexInputRef} that is equivalent to a {@link CorRef},
 * and if found, throws a {@link org.apache.calcite.util.Util.FoundOne}. */
private void findCorrelationEquivalent(CorRef correlation, RexNode e)
    throws Util.FoundOne {
  switch (e.getKind()) {
  case EQUALS:
    final RexCall call = (RexCall) e;
    final List<RexNode> operands = call.getOperands();
    if (references(operands.get(0), correlation)) {
      throw new Util.FoundOne(operands.get(1));
    }
    if (references(operands.get(1), correlation)) {
      throw new Util.FoundOne(operands.get(0));
    }
    break;
  case AND:
    for (RexNode operand : ((RexCall) e).getOperands()) {
      findCorrelationEquivalent(correlation, operand);
    }
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:22,代码来源:RelDecorrelator.java

示例6: contains

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/** Returns whether relational expression {@code target} occurs within a
 * relational expression {@code ancestor}. */
public static boolean contains(RelNode ancestor, final RelNode target) {
  if (ancestor == target) {
    // Short-cut common case.
    return true;
  }
  try {
    new RelVisitor() {
      public void visit(RelNode node, int ordinal, RelNode parent) {
        if (node == target) {
          throw Util.FoundOne.NULL;
        }
        super.visit(node, ordinal, parent);
      }
    // CHECKSTYLE: IGNORE 1
    }.go(ancestor);
    return false;
  } catch (Util.FoundOne e) {
    return true;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:23,代码来源:RelOptUtil.java

示例7: containsGet

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
private static boolean containsGet(RexNode node) {
  try {
    node.accept(
        new RexVisitorImpl<Void>(true) {
          @Override public Void visitCall(RexCall call) {
            if (call.getOperator() == RexBuilder.GET_OPERATOR) {
              throw Util.FoundOne.NULL;
            }
            return super.visitCall(call);
          }
        });
    return false;
  } catch (Util.FoundOne e) {
    return true;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:RelOptUtil.java

示例8: isDeterministic

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Returns whether a given expression is deterministic.
 *
 * @param e Expression
 * @return true if tree result is deterministic, false otherwise
 */
public static boolean isDeterministic(RexNode e) {
  try {
    RexVisitor<Void> visitor =
        new RexVisitorImpl<Void>(true) {
          @Override public Void visitCall(RexCall call) {
            if (!call.getOperator().isDeterministic()) {
              throw Util.FoundOne.NULL;
            }
            return super.visitCall(call);
          }
        };
    e.accept(visitor);
    return true;
  } catch (Util.FoundOne ex) {
    Util.swallow(ex, null);
    return false;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:25,代码来源:RexUtil.java

示例9: findOperatorCall

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Returns whether a given node contains a RexCall with a specified operator
 *
 * @param operator Operator to look for
 * @param node     a RexNode tree
 */
public static RexCall findOperatorCall(
    final SqlOperator operator,
    RexNode node) {
  try {
    RexVisitor<Void> visitor =
        new RexVisitorImpl<Void>(true) {
          public Void visitCall(RexCall call) {
            if (call.getOperator().equals(operator)) {
              throw new Util.FoundOne(call);
            }
            return super.visitCall(call);
          }
        };
    node.accept(visitor);
    return null;
  } catch (Util.FoundOne e) {
    Util.swallow(e, null);
    return (RexCall) e.getNode();
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:27,代码来源:RexUtil.java

示例10: containsInputRef

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Returns whether a given tree contains any {link RexInputRef} nodes.
 *
 * @param node a RexNode tree
 */
public static boolean containsInputRef(
    RexNode node) {
  try {
    RexVisitor<Void> visitor =
        new RexVisitorImpl<Void>(true) {
          public Void visitInputRef(RexInputRef inputRef) {
            throw new Util.FoundOne(inputRef);
          }
        };
    node.accept(visitor);
    return false;
  } catch (Util.FoundOne e) {
    Util.swallow(e, null);
    return true;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:22,代码来源:RexUtil.java

示例11: containsTableInputRef

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Returns whether a given tree contains any {link RexTableInputRef} nodes.
 *
 * @param node a RexNode tree
 * @return first such node found or null if it there is no such node
 */
public static RexTableInputRef containsTableInputRef(RexNode node) {
  try {
    RexVisitor<Void> visitor =
        new RexVisitorImpl<Void>(true) {
          public Void visitTableInputRef(RexTableInputRef inputRef) {
            throw new Util.FoundOne(inputRef);
          }
        };
    node.accept(visitor);
    return null;
  } catch (Util.FoundOne e) {
    Util.swallow(e, null);
    return (RexTableInputRef) e.getNode();
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:22,代码来源:RexUtil.java

示例12: findItemOrFlatten

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
private RexCall findItemOrFlatten(
    final RexNode node,
    final List<RexNode> projExprs) {
  try {
    RexVisitor<Void> visitor =
        new RexVisitorImpl<Void>(true) {
      public Void visitCall(RexCall call) {
        if ("item".equals(call.getOperator().getName().toLowerCase()) ||
          "flatten".equals(call.getOperator().getName().toLowerCase())) {
          throw new Util.FoundOne(call); /* throw exception to interrupt tree walk (this is similar to
                                            other utility methods in RexUtil.java */
        }
        return super.visitCall(call);
      }

      public Void visitInputRef(RexInputRef inputRef) {
        final int index = inputRef.getIndex();
        RexNode n = projExprs.get(index);
        if (n instanceof RexCall) {
          RexCall r = (RexCall) n;
          if ("item".equals(r.getOperator().getName().toLowerCase()) ||
              "flatten".equals(r.getOperator().getName().toLowerCase())) {
            throw new Util.FoundOne(r);
          }
        }

        return super.visitInputRef(inputRef);
      }
    };
    node.accept(visitor);
    return null;
  } catch (Util.FoundOne e) {
    Util.swallow(e, null);
    return (RexCall) e.getNode();
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:37,代码来源:DrillPushFilterPastProjectRule.java

示例13: findItemOrFlatten

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
private RexCall findItemOrFlatten(
    final RexNode node,
    final List<RexNode> projExprs) {
  try {
    RexVisitor<Void> visitor =
        new RexVisitorImpl<Void>(true) {
      @Override
      public Void visitCall(RexCall call) {
        if ("item".equals(call.getOperator().getName().toLowerCase()) ||
          "flatten".equals(call.getOperator().getName().toLowerCase())) {
          throw new Util.FoundOne(call); /* throw exception to interrupt tree walk (this is similar to
                                            other utility methods in RexUtil.java */
        }
        return super.visitCall(call);
      }

      @Override
      public Void visitInputRef(RexInputRef inputRef) {
        final int index = inputRef.getIndex();
        RexNode n = projExprs.get(index);
        if (n instanceof RexCall) {
          RexCall r = (RexCall) n;
          if ("item".equals(r.getOperator().getName().toLowerCase()) ||
              "flatten".equals(r.getOperator().getName().toLowerCase())) {
            throw new Util.FoundOne(r);
          }
        }

        return super.visitInputRef(inputRef);
      }
    };
    node.accept(visitor);
    return null;
  } catch (Util.FoundOne e) {
    Util.swallow(e, null);
    return (RexCall) e.getNode();
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:39,代码来源:PushFilterPastProjectRule.java

示例14: findAgg

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Finds an aggregate.
 *
 * @param node Parse tree to search
 * @return First aggregate function in parse tree, or null if not found
 */
public SqlCall findAgg(SqlNode node) {
  try {
    node.accept(this);
    return null;
  } catch (Util.FoundOne e) {
    Util.swallow(e, null);
    return (SqlCall) e.getNode();
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:16,代码来源:AggFinder.java

示例15: containsAnd

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
boolean containsAnd(SqlNode node) {
  try {
    node.accept(this);
    return false;
  } catch (Util.FoundOne e) {
    return true;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:SqlBetweenOperator.java


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