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); } }
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; }
} catch (CalciteContextException error) { assertThat(error.getMessage(), is("At line 1, column 15: Object 'B' not found")); messagePassingSqlString = error.getMessage(); } catch (CalciteContextException error) { assertThat(error.getMessage(), is(messagePassingSqlString));
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);