@Override public SqlNode visit(SqlCall call) { SqlKind kind = call.getKind(); if (isLogicalNavigation(kind) || isAggregation(kind) || isRunningOrFinal(kind)) { return call; } switch (kind) { case PREV: final List<SqlNode> operands = call.getOperandList(); if (operands.get(0) instanceof SqlIdentifier) { String name = ((SqlIdentifier) operands.get(0)).names.get(0); return name.equals(alpha) ? call : SqlStdOperatorTable.LAST.createCall(SqlParserPos.ZERO, operands); } } return super.visit(call); }
private SqlNode maybeCast(SqlNode node, RelDataType currentType, RelDataType desiredType) { return currentType.equals(desiredType) || (currentType.isNullable() != desiredType.isNullable() && typeFactory.createTypeWithNullability(currentType, desiredType.isNullable()).equals(desiredType)) ? node : SqlStdOperatorTable.CAST.createCall(SqlParserPos.ZERO, node, SqlTypeUtil.convertTypeToSpec(desiredType)); }
selectItem = SqlStdOperatorTable.AS.createCall(SqlParserPos.ZERO, SqlStdOperatorTable.COALESCE.createCall(SqlParserPos.ZERO, maybeCast(selectItem, type, type2), maybeCast(selectItem1, type1, type2)),
/** * Parses a call to TIMESTAMPDIFF. */ final public SqlCall TimestampDiffFunctionCall() throws ParseException { List<SqlNode> args; SqlNode e; final Span s; TimeUnit interval; SqlNode node; jj_consume_token(TIMESTAMPDIFF); s = span(); jj_consume_token(LPAREN); interval = TimestampInterval(); args = startList(SqlLiteral.createSymbol(interval, getPos())); jj_consume_token(COMMA); e = Expression(ExprContext.ACCEPT_SUB_QUERY); args.add(e); jj_consume_token(COMMA); e = Expression(ExprContext.ACCEPT_SUB_QUERY); args.add(e); jj_consume_token(RPAREN); {if (true) return SqlStdOperatorTable.TIMESTAMP_DIFF.createCall( s.end(this), args);} throw new Error("Missing return statement in function"); }
/** * Parses a call to TIMESTAMPADD. */ final public SqlCall TimestampAddFunctionCall() throws ParseException { List<SqlNode> args; SqlNode e; final Span s; TimeUnit interval; SqlNode node; jj_consume_token(TIMESTAMPADD); s = span(); jj_consume_token(LPAREN); interval = TimestampInterval(); args = startList(SqlLiteral.createSymbol(interval, getPos())); jj_consume_token(COMMA); e = Expression(ExprContext.ACCEPT_SUB_QUERY); args.add(e); jj_consume_token(COMMA); e = Expression(ExprContext.ACCEPT_SUB_QUERY); args.add(e); jj_consume_token(RPAREN); {if (true) return SqlStdOperatorTable.TIMESTAMP_ADD.createCall( s.end(this), args);} throw new Error("Missing return statement in function"); }
final public SqlCall MatchRecognizeFunctionCall() throws ParseException { final SqlCall func; final Span s; if (jj_2_563(2)) { jj_consume_token(CLASSIFIER); s = span(); jj_consume_token(LPAREN); jj_consume_token(RPAREN); func = SqlStdOperatorTable.CLASSIFIER.createCall(s.end(this)); } else if (jj_2_564(2)) { jj_consume_token(MATCH_NUMBER); s = span(); jj_consume_token(LPAREN); jj_consume_token(RPAREN); func = SqlStdOperatorTable.MATCH_NUMBER.createCall(s.end(this)); } else if (jj_2_565(2)) { func = MatchRecognizeNavigationLogical(); } else if (jj_2_566(2)) { func = MatchRecognizeNavigationPhysical(); } else if (jj_2_567(2)) { func = MatchRecognizeCallWithModifier(); } else { jj_consume_token(-1); throw new ParseException(); } {if (true) return func;} throw new Error("Missing return statement in function"); }
/** * Parses a call to TIMESTAMPDIFF. */ final public SqlCall TimestampDiffFunctionCall() throws ParseException { List<SqlNode> args; SqlNode e; final Span s; TimeUnit interval; SqlNode node; jj_consume_token(TIMESTAMPDIFF); s = span(); jj_consume_token(LPAREN); interval = TimestampInterval(); args = startList(SqlLiteral.createSymbol(interval, getPos())); jj_consume_token(COMMA); e = Expression(ExprContext.ACCEPT_SUB_QUERY); args.add(e); jj_consume_token(COMMA); e = Expression(ExprContext.ACCEPT_SUB_QUERY); args.add(e); jj_consume_token(RPAREN); {if (true) return SqlStdOperatorTable.TIMESTAMP_DIFF.createCall( s.end(this), args);} throw new Error("Missing return statement in function"); }
/** * Parses a call to TIMESTAMPADD. */ final public SqlCall TimestampAddFunctionCall() throws ParseException { List<SqlNode> args; SqlNode e; final Span s; TimeUnit interval; SqlNode node; jj_consume_token(TIMESTAMPADD); s = span(); jj_consume_token(LPAREN); interval = TimestampInterval(); args = startList(SqlLiteral.createSymbol(interval, getPos())); jj_consume_token(COMMA); e = Expression(ExprContext.ACCEPT_SUB_QUERY); args.add(e); jj_consume_token(COMMA); e = Expression(ExprContext.ACCEPT_SUB_QUERY); args.add(e); jj_consume_token(RPAREN); {if (true) return SqlStdOperatorTable.TIMESTAMP_ADD.createCall( s.end(this), args);} throw new Error("Missing return statement in function"); }
{if (true) return SqlStdOperatorTable.CAST.createCall(s.end(this), args);} } else if (jj_2_550(2)) { jj_consume_token(EXTRACT); args.add(e); jj_consume_token(RPAREN); {if (true) return SqlStdOperatorTable.EXTRACT.createCall(s.end(this), args);} } else if (jj_2_551(2)) { jj_consume_token(POSITION); {if (true) return SqlStdOperatorTable.POSITION.createCall(s.end(this), args);} } else if (jj_2_552(2)) { jj_consume_token(CONVERT); args.add(name); jj_consume_token(RPAREN); {if (true) return SqlStdOperatorTable.CONVERT.createCall(s.end(this), args);} } else if (jj_2_553(2)) { jj_consume_token(TRANSLATE); args.add(name); jj_consume_token(RPAREN); {if (true) return SqlStdOperatorTable.TRANSLATE.createCall(s.end(this), args);} } else if (jj_2_532(2)) { {if (true) return OracleSqlOperatorTable.TRANSLATE3.createCall( s.end(this), args);} } else {
resolvedConstructor.createCall( call.getParserPosition(), call.getOperandList());
final public SqlCall MatchRecognizeFunctionCall() throws ParseException { final SqlCall func; final Span s; if (jj_2_563(2)) { jj_consume_token(CLASSIFIER); s = span(); jj_consume_token(LPAREN); jj_consume_token(RPAREN); func = SqlStdOperatorTable.CLASSIFIER.createCall(s.end(this)); } else if (jj_2_564(2)) { jj_consume_token(MATCH_NUMBER); s = span(); jj_consume_token(LPAREN); jj_consume_token(RPAREN); func = SqlStdOperatorTable.MATCH_NUMBER.createCall(s.end(this)); } else if (jj_2_565(2)) { func = MatchRecognizeNavigationLogical(); } else if (jj_2_566(2)) { func = MatchRecognizeNavigationPhysical(); } else if (jj_2_567(2)) { func = MatchRecognizeCallWithModifier(); } else { jj_consume_token(-1); throw new ParseException(); } {if (true) return func;} throw new Error("Missing return statement in function"); }
{if (true) return SqlStdOperatorTable.CAST.createCall(s.end(this), args);} } else if (jj_2_550(2)) { jj_consume_token(EXTRACT); args.add(e); jj_consume_token(RPAREN); {if (true) return SqlStdOperatorTable.EXTRACT.createCall(s.end(this), args);} } else if (jj_2_551(2)) { jj_consume_token(POSITION); {if (true) return SqlStdOperatorTable.POSITION.createCall(s.end(this), args);} } else if (jj_2_552(2)) { jj_consume_token(CONVERT); args.add(name); jj_consume_token(RPAREN); {if (true) return SqlStdOperatorTable.CONVERT.createCall(s.end(this), args);} } else if (jj_2_553(2)) { jj_consume_token(TRANSLATE); args.add(name); jj_consume_token(RPAREN); {if (true) return SqlStdOperatorTable.TRANSLATE.createCall(s.end(this), args);} } else if (jj_2_532(2)) { {if (true) return OracleSqlOperatorTable.TRANSLATE3.createCall( s.end(this), args);} } else {
/** * Parses a call to TIMESTAMPDIFF. */ final public SqlCall TimestampDiffFunctionCall() throws ParseException {List<SqlNode> args; SqlNode e; final Span s; TimeUnit interval; SqlNode node; jj_consume_token(TIMESTAMPDIFF); s = span(); jj_consume_token(LPAREN); interval = TimestampInterval(); args = startList(SqlLiteral.createSymbol(interval, getPos())); jj_consume_token(COMMA); e = Expression(ExprContext.ACCEPT_SUB_QUERY); args.add(e); jj_consume_token(COMMA); e = Expression(ExprContext.ACCEPT_SUB_QUERY); args.add(e); jj_consume_token(RPAREN); {if ("" != null) return SqlStdOperatorTable.TIMESTAMP_DIFF.createCall( s.end(this), args);} throw new Error("Missing return statement in function"); }
/** * Parses a call to TIMESTAMPADD. */ final public SqlCall TimestampAddFunctionCall() throws ParseException {List<SqlNode> args; SqlNode e; final Span s; TimeUnit interval; SqlNode node; jj_consume_token(TIMESTAMPADD); s = span(); jj_consume_token(LPAREN); interval = TimestampInterval(); args = startList(SqlLiteral.createSymbol(interval, getPos())); jj_consume_token(COMMA); e = Expression(ExprContext.ACCEPT_SUB_QUERY); args.add(e); jj_consume_token(COMMA); e = Expression(ExprContext.ACCEPT_SUB_QUERY); args.add(e); jj_consume_token(RPAREN); {if ("" != null) return SqlStdOperatorTable.TIMESTAMP_ADD.createCall( s.end(this), args);} throw new Error("Missing return statement in function"); }
final public SqlCall MatchRecognizeFunctionCall() throws ParseException {final SqlCall func; final Span s; if (jj_2_568(2)) { jj_consume_token(CLASSIFIER); s = span(); jj_consume_token(LPAREN); jj_consume_token(RPAREN); func = SqlStdOperatorTable.CLASSIFIER.createCall(s.end(this)); } else if (jj_2_569(2)) { jj_consume_token(MATCH_NUMBER); s = span(); jj_consume_token(LPAREN); jj_consume_token(RPAREN); func = SqlStdOperatorTable.MATCH_NUMBER.createCall(s.end(this)); } else if (jj_2_570(2)) { func = MatchRecognizeNavigationLogical(); } else if (jj_2_571(2)) { func = MatchRecognizeNavigationPhysical(); } else if (jj_2_572(2)) { func = MatchRecognizeCallWithModifier(); } else { jj_consume_token(-1); throw new ParseException(); } {if ("" != null) return func;} throw new Error("Missing return statement in function"); }
{if ("" != null) return SqlStdOperatorTable.CAST.createCall(s.end(this), args);} } else if (jj_2_555(2)) { jj_consume_token(EXTRACT); args.add(e); jj_consume_token(RPAREN); {if ("" != null) return SqlStdOperatorTable.EXTRACT.createCall(s.end(this), args);} } else if (jj_2_556(2)) { jj_consume_token(POSITION); {if ("" != null) return SqlStdOperatorTable.POSITION.createCall(s.end(this), args);} } else if (jj_2_557(2)) { jj_consume_token(CONVERT); args.add(name); jj_consume_token(RPAREN); {if ("" != null) return SqlStdOperatorTable.CONVERT.createCall(s.end(this), args);} } else if (jj_2_558(2)) { jj_consume_token(TRANSLATE); args.add(name); jj_consume_token(RPAREN); {if ("" != null) return SqlStdOperatorTable.TRANSLATE.createCall(s.end(this), args);} } else if (jj_2_537(2)) { {if ("" != null) return OracleSqlOperatorTable.TRANSLATE3.createCall( s.end(this), args);} } else {
private SqlNode getCastedSqlNode(SqlNode argInput, RelDataType varType, SqlParserPos pos, RexNode argRex) { SqlNode arg; if (argRex != null && !argRex.getType().equals(varType)) { arg = SqlStdOperatorTable.CAST.createCall( pos, argInput, SqlTypeUtil.convertTypeToSpec(varType)); } else { arg = argInput; } return arg; } }
@Override public SqlNode rewriteCall(SqlValidator validator, SqlCall call) { final List<SqlNode> operands = call.getOperandList(); final SqlParserPos pos = call.getParserPosition(); return SqlStdOperatorTable.EXTRACT.createCall(pos, new SqlIntervalQualifier(timeUnit, null, SqlParserPos.ZERO), operands.get(0)); }
@Override public SqlNode rewriteCall(SqlValidator validator, SqlCall call) { final List<SqlNode> operands = call.getOperandList(); final SqlParserPos pos = call.getParserPosition(); return SqlStdOperatorTable.EXTRACT.createCall(pos, new SqlIntervalQualifier(timeUnit, null, SqlParserPos.ZERO), operands.get(0)); }
private SqlNode maybeCast(SqlNode node, RelDataType currentType, RelDataType desiredType) { return currentType.equals(desiredType) || (currentType.isNullable() != desiredType.isNullable() && typeFactory.createTypeWithNullability(currentType, desiredType.isNullable()).equals(desiredType)) ? node : SqlStdOperatorTable.CAST.createCall(SqlParserPos.ZERO, node, SqlTypeUtil.convertTypeToSpec(desiredType)); }