Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query with SAFE_CAST couldn't be parsed #853

Closed
sivaraam opened this issue Sep 24, 2019 · 1 comment
Closed

Query with SAFE_CAST couldn't be parsed #853

sivaraam opened this issue Sep 24, 2019 · 1 comment

Comments

@sivaraam
Copy link
Contributor

Describe the bug
A query with SAFE_CAST function used in it could not be parsed.

To Reproduce
Steps to reproduce the behavior:

  1. Example query (reference
    SELECT SAFE_CAST("apple" AS INT64) AS not_a_number;
  2. Parsing using JSqlParser
        try {
            Statement safeCastSt =
                    CCJSqlParserUtil.parse("SELECT SAFE_CAST(\"apple\" AS INT64) AS not_a_number");
        } catch (JSQLParserException e) {
            e.printStackTrace();
        }
  3. Exception thrown
net.sf.jsqlparser.JSQLParserException
	at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:51)
    ...
    <snipped>
    ...
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "(" "("
    at line 1, column 17.

Was expecting one of:

    "&"
    ","
    "::"
    ";"
    "<<"
    ">>"
    "ACTION"
    ...

Expected behavior
The query would parse successfully.

System

  • Java Version: 11.0.3
  • JSqlParser version: 3.0
@manticore-projects
Copy link
Contributor

Fixed by #1634, works with JSQLParser 4.6 Snapshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants