org.apache.calcite.runtime.Resources Java Examples

The following examples show how to use org.apache.calcite.runtime.Resources. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SqlUtil.java    From calcite with Apache License 2.0 5 votes vote down vote up
/**
 * Wraps an exception with context.
 */
public static CalciteContextException newContextException(
    int line,
    int col,
    int endLine,
    int endCol,
    Resources.ExInst<?> e) {
  CalciteContextException contextExcn =
      (line == endLine && col == endCol
          ? RESOURCE.validatorContextPoint(line, col)
          : RESOURCE.validatorContext(line, col, endLine, endCol)).ex(e.ex());
  contextExcn.setPosition(line, col, endLine, endCol);
  return contextExcn;
}
 
Example #2
Source File: SqlUtil.java    From calcite with Apache License 2.0 5 votes vote down vote up
/**
 * Wraps an exception with context.
 */
public static CalciteContextException newContextException(
    final SqlParserPos pos,
    Resources.ExInst<?> e) {
  int line = pos.getLineNum();
  int col = pos.getColumnNum();
  int endLine = pos.getEndLineNum();
  int endCol = pos.getEndColumnNum();
  return newContextException(line, col, endLine, endCol, e);
}
 
Example #3
Source File: SqlUtil.java    From calcite with Apache License 2.0 5 votes vote down vote up
/**
 * Wraps an exception with context.
 */
public static CalciteException newContextException(
    final SqlParserPos pos,
    Resources.ExInst<?> e,
    String inputText) {
  CalciteContextException ex = newContextException(pos, e);
  ex.setOriginalStatement(inputText);
  return ex;
}
 
Example #4
Source File: ExplicitOperatorBinding.java    From calcite with Apache License 2.0 5 votes vote down vote up
public CalciteException newError(
    Resources.ExInst<SqlValidatorException> e) {
  if (delegate != null) {
    return delegate.newError(e);
  } else {
    return SqlUtil.newContextException(SqlParserPos.ZERO, e);
  }
}
 
Example #5
Source File: UtilTest.java    From calcite with Apache License 2.0 4 votes vote down vote up
@Test void testResources() {
  Resources.validate(Static.RESOURCE);
  checkResourceMethodNames(Static.RESOURCE);
}
 
Example #6
Source File: SqlValidatorImpl.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
ValidationError(SqlNode sqlNode,
	Resources.ExInst<SqlValidatorException> validatorException) {
	this.sqlNode = sqlNode;
	this.validatorException = validatorException;
}
 
Example #7
Source File: RexCallBinding.java    From calcite with Apache License 2.0 4 votes vote down vote up
public CalciteException newError(
    Resources.ExInst<SqlValidatorException> e) {
  return SqlUtil.newContextException(SqlParserPos.ZERO, e);
}
 
Example #8
Source File: SqlCallBinding.java    From calcite with Apache License 2.0 4 votes vote down vote up
public CalciteException newError(
    Resources.ExInst<SqlValidatorException> e) {
  return validator.newValidationError(call, e);
}
 
Example #9
Source File: Aggregate.java    From calcite with Apache License 2.0 4 votes vote down vote up
public CalciteException newError(
    Resources.ExInst<SqlValidatorException> e) {
  return SqlUtil.newContextException(SqlParserPos.ZERO, e);
}
 
Example #10
Source File: ParserResource.java    From flink with Apache License 2.0 4 votes vote down vote up
@Resources.BaseMessage("OVERWRITE expression is only used with INSERT statement.")
Resources.ExInst<ParseException> overwriteIsOnlyUsedWithInsert();
 
Example #11
Source File: ParserResource.java    From flink with Apache License 2.0 4 votes vote down vote up
@Resources.BaseMessage("Multiple WATERMARK statements is not supported yet.")
Resources.ExInst<ParseException> multipleWatermarksUnsupported();
 
Example #12
Source File: SqlValidatorImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
public CalciteContextException newValidationError(SqlNode node,
	Resources.ExInst<SqlValidatorException> e) {
	assert node != null;
	final SqlParserPos pos = node.getParserPosition();
	return SqlUtil.newContextException(pos, e);
}
 
Example #13
Source File: SqlValidatorImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override public CalciteContextException apply(
	SqlNode v0, Resources.ExInst<SqlValidatorException> v1) {
	return newValidationError(v0, v1);
}
 
Example #14
Source File: SqlValidatorImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
ValidationError(SqlNode sqlNode,
	Resources.ExInst<SqlValidatorException> validatorException) {
	this.sqlNode = sqlNode;
	this.validatorException = validatorException;
}
 
Example #15
Source File: SqlValidatorImpl.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public CalciteContextException newValidationError(SqlNode node,
	Resources.ExInst<SqlValidatorException> e) {
	assert node != null;
	final SqlParserPos pos = node.getParserPosition();
	return SqlUtil.newContextException(pos, e);
}
 
Example #16
Source File: SqlValidatorImpl.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override public CalciteContextException apply(
	SqlNode v0, Resources.ExInst<SqlValidatorException> v1) {
	return newValidationError(v0, v1);
}
 
Example #17
Source File: SqlOperatorBinding.java    From calcite with Apache License 2.0 2 votes vote down vote up
/**
 * Wraps a validation error with context appropriate to this operator call.
 *
 * @param e Validation error, not null
 * @return Error wrapped, if possible, with positional information
 */
public abstract CalciteException newError(
    Resources.ExInst<SqlValidatorException> e);
 
Example #18
Source File: SqlValidator.java    From calcite with Apache License 2.0 2 votes vote down vote up
/**
 * Adds "line x, column y" context to a validator exception.
 *
 * <p>Note that the input exception is checked (it derives from
 * {@link Exception}) and the output exception is unchecked (it derives from
 * {@link RuntimeException}). This is intentional -- it should remind code
 * authors to provide context for their validation errors.</p>
 *
 * @param node The place where the exception occurred, not null
 * @param e    The validation error
 * @return Exception containing positional information, never null
 */
CalciteContextException newValidationError(
    SqlNode node,
    Resources.ExInst<SqlValidatorException> e);
 
Example #19
Source File: SqlCallBinding.java    From calcite with Apache License 2.0 2 votes vote down vote up
/**
 * Constructs a new validation error for the call. (Do not use this to
 * construct a validation error for other nodes such as an operands.)
 *
 * @param ex underlying exception
 * @return wrapped exception
 */
public CalciteException newValidationError(
    Resources.ExInst<SqlValidatorException> ex) {
  return validator.newValidationError(call, ex);
}