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


Java Util.swallow方法代码示例

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


在下文中一共展示了Util.swallow方法的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: 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

示例4: 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

示例5: 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

示例6: containsFieldAccess

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

示例7: containNoForwardRefs

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Returns whether an array of expressions contains no forward references.
 * That is, if expression #i contains a {@link RexInputRef} referencing
 * field i or greater.
 *
 * @param exprs        Array of expressions
 * @param inputRowType Input row type
 * @param litmus       What to do if an error is detected (there is a
 *                     forward reference)
 *
 * @return Whether there is a forward reference
 */
public static boolean containNoForwardRefs(List<RexNode> exprs,
    RelDataType inputRowType,
    Litmus litmus) {
  final ForwardRefFinder visitor = new ForwardRefFinder(inputRowType);
  for (int i = 0; i < exprs.size(); i++) {
    RexNode expr = exprs.get(i);
    visitor.setLimit(i); // field cannot refer to self or later field
    try {
      expr.accept(visitor);
    } catch (ForwardRefFinder.IllegalForwardRefException e) {
      Util.swallow(e, null);
      return litmus.fail("illegal forward reference in {}", expr);
    }
  }
  return litmus.succeed();
}
 
开发者ID:apache,项目名称:calcite,代码行数:29,代码来源:RexUtil.java

示例8: 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

示例9: 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

示例10: 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

示例11: containsOver

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Returns whether a program contains an OVER clause.
 */
public static boolean containsOver(RexProgram program) {
  try {
    RexUtil.apply(FINDER, program.getExprList(), null);
    return false;
  } catch (OverFound e) {
    Util.swallow(e, null);
    return true;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:RexOver.java

示例12: execute

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
public void execute(ConcurrentTestCommandExecutor exec) throws Exception {
  try {
    doExecute(exec);
    if (shouldFail) {
      throw new ConcurrentTestCommand.ShouldHaveFailedException(
          failComment);
    }
  } catch (SQLException err) {
    if (!shouldFail) {
      throw err;
    }
    boolean matches = false;
    if (failPattern == null) {
      matches = true; // by default
    } else {
      for (SQLException err2 = err; err2 != null;
           err2 = err2.getNextException()) {
        String msg = err2.getMessage();
        if (msg != null) {
          matches = failPattern.matcher(msg).find();
        }
        if (matches) {
          break;
        }
      }
    }
    if (!matches) {
      // an unexpected error
      throw err;
    } else {
      // else swallow it
      Util.swallow(err, null);
    }
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:36,代码来源:ConcurrentTestCommandGenerator.java

示例13: validateFrom

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
protected void validateFrom(
    SqlNode node,
    RelDataType targetRowType,
    SqlValidatorScope scope) {
  try {
    super.validateFrom(node, targetRowType, scope);
  } catch (CalciteException e) {
    Util.swallow(e, TRACER);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:SqlAdvisorValidator.java

示例14: validateWhereClause

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Calls the parent class method and masks Farrago exception thrown.
 */
protected void validateWhereClause(SqlSelect select) {
  try {
    super.validateWhereClause(select);
  } catch (CalciteException e) {
    Util.swallow(e, TRACER);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:SqlAdvisorValidator.java

示例15: validateHavingClause

import org.apache.calcite.util.Util; //导入方法依赖的package包/类
/**
 * Calls the parent class method and masks Farrago exception thrown.
 */
protected void validateHavingClause(SqlSelect select) {
  try {
    super.validateHavingClause(select);
  } catch (CalciteException e) {
    Util.swallow(e, TRACER);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:SqlAdvisorValidator.java


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