/** Parses a unsigned numeric literal */ final public SqlNumericLiteral UnsignedNumericLiteral() throws ParseException { if (jj_2_321(2)) { jj_consume_token(UNSIGNED_INTEGER_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_322(2)) { jj_consume_token(DECIMAL_NUMERIC_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_323(2)) { jj_consume_token(APPROX_NUMERIC_LITERAL); {if (true) return SqlLiteral.createApproxNumeric(token.image, getPos());} } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); }
/** Parses a unsigned numeric literal */ final public SqlNumericLiteral UnsignedNumericLiteral() throws ParseException { if (jj_2_321(2)) { jj_consume_token(UNSIGNED_INTEGER_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_322(2)) { jj_consume_token(DECIMAL_NUMERIC_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_323(2)) { jj_consume_token(APPROX_NUMERIC_LITERAL); {if (true) return SqlLiteral.createApproxNumeric(token.image, getPos());} } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); }
/** Parses a unsigned numeric literal */ final public SqlNumericLiteral UnsignedNumericLiteral() throws ParseException { if (jj_2_326(2)) { jj_consume_token(UNSIGNED_INTEGER_LITERAL); {if ("" != null) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_327(2)) { jj_consume_token(DECIMAL_NUMERIC_LITERAL); {if ("" != null) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_328(2)) { jj_consume_token(APPROX_NUMERIC_LITERAL); {if ("" != null) return SqlLiteral.createApproxNumeric(token.image, getPos());} } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); }
return SqlLiteral.createApproxNumeric( literal.getValue().toString(), SqlParserPos.ZERO);
return SqlLiteral.createApproxNumeric( literal.getValue().toString(), SqlParserPos.ZERO);
POS); case APPROXIMATE_NUMERIC: return SqlLiteral.createApproxNumeric( literal.getValue().toString(), POS); case BOOLEAN:
@Override public SqlNode rewriteSingleValueExpr(SqlNode aggCall) { final SqlNode operand = ((SqlBasicCall) aggCall).operand(0); final SqlLiteral nullLiteral = SqlLiteral.createNull(SqlParserPos.ZERO); final SqlNode unionOperand = SqlStdOperatorTable.VALUES.createCall(SqlParserPos.ZERO, SqlLiteral.createApproxNumeric("0", SqlParserPos.ZERO)); // For hsqldb, generate // CASE COUNT(*) // WHEN 0 THEN NULL // WHEN 1 THEN MIN(<result>) // ELSE (VALUES 1 UNION ALL VALUES 1) // END final SqlNode caseExpr = new SqlCase(SqlParserPos.ZERO, SqlStdOperatorTable.COUNT.createCall(SqlParserPos.ZERO, operand), SqlNodeList.of( SqlLiteral.createExactNumeric("0", SqlParserPos.ZERO), SqlLiteral.createExactNumeric("1", SqlParserPos.ZERO)), SqlNodeList.of( nullLiteral, SqlStdOperatorTable.MIN.createCall(SqlParserPos.ZERO, operand)), SqlStdOperatorTable.SCALAR_QUERY.createCall(SqlParserPos.ZERO, SqlStdOperatorTable.UNION_ALL .createCall(SqlParserPos.ZERO, unionOperand, unionOperand))); LOGGER.debug("SINGLE_VALUE rewritten into [{}]", caseExpr); return caseExpr; }
@Override public SqlNode rewriteSingleValueExpr(SqlNode aggCall) { final SqlNode operand = ((SqlBasicCall) aggCall).operand(0); final SqlLiteral nullLiteral = SqlLiteral.createNull(SqlParserPos.ZERO); final SqlNode unionOperand = SqlStdOperatorTable.VALUES.createCall(SqlParserPos.ZERO, SqlLiteral.createApproxNumeric("0", SqlParserPos.ZERO)); // For hsqldb, generate // CASE COUNT(*) // WHEN 0 THEN NULL // WHEN 1 THEN MIN(<result>) // ELSE (VALUES 1 UNION ALL VALUES 1) // END final SqlNode caseExpr = new SqlCase(SqlParserPos.ZERO, SqlStdOperatorTable.COUNT.createCall(SqlParserPos.ZERO, operand), SqlNodeList.of( SqlLiteral.createExactNumeric("0", SqlParserPos.ZERO), SqlLiteral.createExactNumeric("1", SqlParserPos.ZERO) ), SqlNodeList.of( nullLiteral, SqlStdOperatorTable.MIN.createCall(SqlParserPos.ZERO, operand) ), SqlStdOperatorTable.SCALAR_QUERY.createCall(SqlParserPos.ZERO, SqlStdOperatorTable.UNION_ALL .createCall(SqlParserPos.ZERO, unionOperand, unionOperand))); LOGGER.debug("SINGLE_VALUE rewritten into [{}]", caseExpr); return caseExpr; }
literal.getValueAs(BigDecimal.class).toString(), POS); case APPROXIMATE_NUMERIC: return SqlLiteral.createApproxNumeric( literal.getValueAs(BigDecimal.class).toString(), POS); case BOOLEAN:
/** Parses a unsigned numeric literal */ final public SqlNumericLiteral UnsignedNumericLiteral() throws ParseException { if (jj_2_455(2)) { jj_consume_token(UNSIGNED_INTEGER_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_456(2)) { jj_consume_token(DECIMAL_NUMERIC_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_457(2)) { jj_consume_token(APPROX_NUMERIC_LITERAL); {if (true) return SqlLiteral.createApproxNumeric(token.image, getPos());} } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); }
/** Parses a unsigned numeric literal */ final public SqlNumericLiteral UnsignedNumericLiteral() throws ParseException { if (jj_2_359(2)) { jj_consume_token(UNSIGNED_INTEGER_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_360(2)) { jj_consume_token(DECIMAL_NUMERIC_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_361(2)) { jj_consume_token(APPROX_NUMERIC_LITERAL); {if (true) return SqlLiteral.createApproxNumeric(token.image, getPos());} } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); }
/** Parses a unsigned numeric literal */ final public SqlNumericLiteral UnsignedNumericLiteral() throws ParseException { if (jj_2_329(2)) { jj_consume_token(UNSIGNED_INTEGER_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_330(2)) { jj_consume_token(DECIMAL_NUMERIC_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_331(2)) { jj_consume_token(APPROX_NUMERIC_LITERAL); {if (true) return SqlLiteral.createApproxNumeric(token.image, getPos());} } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); }
/** Parses a unsigned numeric literal */ final public SqlNumericLiteral UnsignedNumericLiteral() throws ParseException { if (jj_2_261(2)) { jj_consume_token(UNSIGNED_INTEGER_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_262(2)) { jj_consume_token(DECIMAL_NUMERIC_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_263(2)) { jj_consume_token(APPROX_NUMERIC_LITERAL); {if (true) return SqlLiteral.createApproxNumeric(token.image, getPos());} } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); }
/** Parses a unsigned numeric literal */ final public SqlNumericLiteral UnsignedNumericLiteral() throws ParseException { if (jj_2_318(2)) { jj_consume_token(UNSIGNED_INTEGER_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_319(2)) { jj_consume_token(DECIMAL_NUMERIC_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_320(2)) { jj_consume_token(APPROX_NUMERIC_LITERAL); {if (true) return SqlLiteral.createApproxNumeric(token.image, getPos());} } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); }
/** Parses a unsigned numeric literal */ final public SqlNumericLiteral UnsignedNumericLiteral() throws ParseException { if (jj_2_365(2)) { jj_consume_token(UNSIGNED_INTEGER_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_366(2)) { jj_consume_token(DECIMAL_NUMERIC_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_367(2)) { jj_consume_token(APPROX_NUMERIC_LITERAL); {if (true) return SqlLiteral.createApproxNumeric(token.image, getPos());} } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); }
/** Parses a unsigned numeric literal */ final public SqlNumericLiteral UnsignedNumericLiteral() throws ParseException { if (jj_2_305(2)) { jj_consume_token(UNSIGNED_INTEGER_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_306(2)) { jj_consume_token(DECIMAL_NUMERIC_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_307(2)) { jj_consume_token(APPROX_NUMERIC_LITERAL); {if (true) return SqlLiteral.createApproxNumeric(token.image, getPos());} } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); }
literal.getValueAs(BigDecimal.class).toString(), POS); case APPROXIMATE_NUMERIC: return SqlLiteral.createApproxNumeric( literal.getValueAs(BigDecimal.class).toString(), POS); case BOOLEAN:
wrappedOperand = SqlStdOperatorTable.MIN.createCall(POS, operand); unionOperand = SqlStdOperatorTable.VALUES.createCall(POS, SqlLiteral.createApproxNumeric("0", POS));
/** Parses a unsigned numeric literal */ final public SqlNumericLiteral UnsignedNumericLiteral() throws ParseException { if (jj_2_324(2)) { jj_consume_token(UNSIGNED_INTEGER_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_325(2)) { jj_consume_token(DECIMAL_NUMERIC_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_326(2)) { jj_consume_token(APPROX_NUMERIC_LITERAL); {if (true) return SqlLiteral.createApproxNumeric(token.image, getPos());} } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); }
/** Parses a unsigned numeric literal */ final public SqlNumericLiteral UnsignedNumericLiteral() throws ParseException { if (jj_2_261(2)) { jj_consume_token(UNSIGNED_INTEGER_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_262(2)) { jj_consume_token(DECIMAL_NUMERIC_LITERAL); {if (true) return SqlLiteral.createExactNumeric(token.image, getPos());} } else if (jj_2_263(2)) { jj_consume_token(APPROX_NUMERIC_LITERAL); {if (true) return SqlLiteral.createApproxNumeric(token.image, getPos());} } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); }