/** * Uses reflection to invoke a method on this parser. The method must be * public and have no parameters. * * @param parserImpl Parser * @param name Name of method. For example "ReservedFunctionName". * @return Result of calling method */ private Object virtualCall( SqlAbstractParserImpl parserImpl, String name) throws Throwable { Class<?> clazz = parserImpl.getClass(); try { final Method method = clazz.getMethod(name, (Class[]) null); return method.invoke(parserImpl, (Object[]) null); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); throw parserImpl.normalizeException(cause); } }
/** * Uses reflection to invoke a method on this parser. The method must be * public and have no parameters. * * @param parserImpl Parser * @param name Name of method. For example "ReservedFunctionName". * @return Result of calling method */ private Object virtualCall( SqlAbstractParserImpl parserImpl, String name) throws Throwable { Class<?> clazz = parserImpl.getClass(); try { final Method method = clazz.getMethod(name, (Class[]) null); return method.invoke(parserImpl, (Object[]) null); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); throw parserImpl.normalizeException(cause); } }
/** * Parses a SQL expression. * * @throws SqlParseException if there is a parse error */ public SqlNode parseExpression() throws SqlParseException { try { return parser.parseSqlExpressionEof(); } catch (Throwable ex) { if ((ex instanceof CalciteContextException) && (originalInput != null)) { ((CalciteContextException) ex).setOriginalStatement( originalInput); } throw parser.normalizeException(ex); } }
/** * Parses a <code>SELECT</code> statement. * * @return A {@link org.apache.calcite.sql.SqlSelect} for a regular <code> * SELECT</code> statement; a {@link org.apache.calcite.sql.SqlBinaryOperator} * for a <code>UNION</code>, <code>INTERSECT</code>, or <code>EXCEPT</code>. * @throws SqlParseException if there is a parse error */ public SqlNode parseQuery() throws SqlParseException { try { return parser.parseSqlStmtEof(); } catch (Throwable ex) { if ((ex instanceof CalciteContextException) && (originalInput != null)) { ((CalciteContextException) ex).setOriginalStatement( originalInput); } throw parser.normalizeException(ex); } }
/** * Parses a SQL expression. * * @throws SqlParseException if there is a parse error */ public SqlNode parseExpression() throws SqlParseException { try { return parser.parseSqlExpressionEof(); } catch (Throwable ex) { if (ex instanceof CalciteContextException) { final String originalSql = parser.getOriginalSql(); if (originalSql != null) { ((CalciteContextException) ex).setOriginalStatement(originalSql); } } throw parser.normalizeException(ex); } }
/** * Parses a <code>SELECT</code> statement. * * @return A {@link org.apache.calcite.sql.SqlSelect} for a regular <code> * SELECT</code> statement; a {@link org.apache.calcite.sql.SqlBinaryOperator} * for a <code>UNION</code>, <code>INTERSECT</code>, or <code>EXCEPT</code>. * @throws SqlParseException if there is a parse error */ public SqlNode parseQuery() throws SqlParseException { try { return parser.parseSqlStmtEof(); } catch (Throwable ex) { if (ex instanceof CalciteContextException) { final String originalSql = parser.getOriginalSql(); if (originalSql != null) { ((CalciteContextException) ex).setOriginalStatement(originalSql); } } throw parser.normalizeException(ex); } }