(CalciteContextException) ex; pos = new SqlParserPos( ece.getPosLine(), ece.getPosColumn(), ece.getEndPosLine(), ece.getEndPosColumn()); ex = ece.getCause();
public static UserException.Builder planError(String query, Exception ex) { UserException.Builder b = UserException.planError(ex) .addContext(SQL_QUERY_CONTEXT, query); // CalciteContextException alters the error message including the start/end positions // we need to extract the original error message and add the remaining information as context if (ex instanceof CalciteContextException) { CalciteContextException cce = (CalciteContextException) ex; b.message(cce.getMessage()) .addContext(START_LINE_CONTEXT, cce.getPosLine()) .addContext(START_COLUMN_CONTEXT, cce.getPosColumn()) .addContext(END_LINE_CONTEXT, cce.getEndPosLine()) .addContext(END_COLUMN_CONTEXT, cce.getEndPosColumn()); } return b; }
@Override public String getMessage() { // The superclass' message is the textual context information // for this exception, so we add in the underlying cause to the message return super.getMessage() + ": " + getCause().getMessage(); } }
} catch (CalciteContextException error) { assertThat(error.getMessage(), is("At line 1, column 15: Object 'B' not found")); messagePassingSqlString = error.getMessage(); assertNull(error.getOriginalStatement()); } catch (CalciteContextException error) { assertThat(error.getMessage(), is(messagePassingSqlString)); assertThat(error.getOriginalStatement(), nullValue());
/** * Creates a new CalciteContextException object. * * @param message error message * @param cause underlying cause, must not be null * @param posLine 1-based start line number * @param posColumn 1-based start column number * @param endPosLine 1-based end line number * @param endPosColumn 1-based end column number */ public CalciteContextException( String message, Throwable cause, int posLine, int posColumn, int endPosLine, int endPosColumn) { super(message, cause); assert cause != null; setPosition(posLine, posColumn, endPosLine, endPosColumn); }
private RelNode parseInternal(String sql) throws SQLException { try { //final CalcitePrepare.Context prepareContext = context.getPrepareContext(); //Class elementType = Object[].class; //RelNode relNode = new QuarkPrepare().prepare(prepareContext, sql, elementType, -1); RelNode relNode = this.worker.parse(sql); LOG.info("\n" + RelOptUtil.dumpPlan( "", relNode, false, SqlExplainLevel.ALL_ATTRIBUTES)); return relNode; } catch (CalciteContextException e) { throw new SQLException(e.getMessage(), e); } }
@Override public String getMessage() { // The superclass' message is the textual context information // for this exception, so we add in the underlying cause to the message return super.getMessage() + ": " + getCause().getMessage(); } }
LOG.log(Level.INFO, "Error while parsing '" + ex.getOriginalStatement() + "'", ex); throw new StatementExecutionException(ex.getMessage()); } catch (RelConversionException | ValidationException | SqlParseException ex) { LOG.log(Level.INFO, "Error while parsing '" + query + "'", ex);
/** * Creates a new CalciteContextException object. * * @param message error message * @param cause underlying cause, must not be null * @param posLine 1-based start line number * @param posColumn 1-based start column number * @param endPosLine 1-based end line number * @param endPosColumn 1-based end column number */ public CalciteContextException( String message, Throwable cause, int posLine, int posColumn, int endPosLine, int endPosColumn) { super(message, cause); assert cause != null; setPosition(posLine, posColumn, endPosLine, endPosColumn); }
(CalciteContextException) ex; pos = new SqlParserPos( ece.getPosLine(), ece.getPosColumn(), ece.getEndPosLine(), ece.getEndPosColumn()); ex = ece.getCause();
/** * 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; }
(CalciteContextException) ex; pos = new SqlParserPos( ece.getPosLine(), ece.getPosColumn(), ece.getEndPosLine(), ece.getEndPosColumn()); ex = ece.getCause();
/** * 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; }
/** * Creates a new ValidateErrorInfo with an CalciteContextException. * * @param e Exception */ public ValidateErrorInfo( CalciteContextException e) { this.startLineNum = e.getPosLine(); this.startColumnNum = e.getPosColumn(); this.endLineNum = e.getEndPosLine(); this.endColumnNum = e.getEndPosColumn(); this.errorMsg = e.getCause().getMessage(); }
@Override public void validateAggregateParams(SqlCall aggCall, SqlNode filter, SqlValidatorScope scope) { if (filter != null) { Exception e = new SqlValidatorException("Dremio does not currently support aggregate functions with a filter clause", null); SqlParserPos pos = filter.getParserPosition(); CalciteContextException ex = RESOURCE.validatorContextPoint(pos.getLineNum(), pos.getColumnNum()).ex(e); ex.setPosition(pos.getLineNum(), pos.getColumnNum()); throw ex; } super.validateAggregateParams(aggCall, filter, scope); } }
/** * Creates a new ValidateErrorInfo with an CalciteContextException. * * @param e Exception */ public ValidateErrorInfo( CalciteContextException e) { this.startLineNum = e.getPosLine(); this.startColumnNum = e.getPosColumn(); this.endLineNum = e.getEndPosLine(); this.endColumnNum = e.getEndPosColumn(); this.errorMsg = e.getCause().getMessage(); }
(CalciteContextException) ex; pos = new SqlParserPos( ece.getPosLine(), ece.getPosColumn(), ece.getEndPosLine(), ece.getEndPosColumn()); ex = ece.getCause();
(CalciteContextException) ex; pos = new SqlParserPos( ece.getPosLine(), ece.getPosColumn(), ece.getEndPosLine(), ece.getEndPosColumn()); ex = ece.getCause();
(CalciteContextException) ex; pos = new SqlParserPos( ece.getPosLine(), ece.getPosColumn(), ece.getEndPosLine(), ece.getEndPosColumn()); ex = ece.getCause();
(CalciteContextException) ex; pos = new SqlParserPos( ece.getPosLine(), ece.getPosColumn(), ece.getEndPosLine(), ece.getEndPosColumn()); ex = ece.getCause();