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

[BUG] cannot parse presto sql with try_cast() function #6280

Open
ZhuangTang3 opened this issue Dec 11, 2024 · 1 comment
Open

[BUG] cannot parse presto sql with try_cast() function #6280

ZhuangTang3 opened this issue Dec 11, 2024 · 1 comment

Comments

@ZhuangTang3
Copy link

Database Type

Presto

Database Version

Presto 0.283

Druid Version

1.1.17

JDK Version

OpenJDK17

Error SQL

select try_cast(dt_day as int) 
from ads_test.employee_task_info_1d_f 
where dt_day = '$[yyyyMMdd-1]'

Testcase Code

String dbType = JdbcConstants.PRESTO;
List<SQLStatement> stmtList = com.alibaba.druid.sql.SQLUtils.parseStatements(querySQL, dbType);
SQLStatement stmt = stmtList.get(0);

Stacktrace Info

syntax error, expect RPAREN, actual AS pos 25, line 1, column 23, token AS
com.alibaba.druid.sql.parser.ParserException: syntax error, expect RPAREN, actual AS pos 25, line 1, column 23, token AS
at com.alibaba.druid.sql.parser.SQLExprParser.accept(SQLExprParser.java:2742)
at com.alibaba.druid.sql.parser.SQLExprParser.methodRest(SQLExprParser.java:1192)
at com.alibaba.druid.sql.parser.SQLExprParser.parseSelectItem(SQLExprParser.java:3339)
at com.alibaba.druid.sql.parser.SQLSelectParser.parseSelectList(SQLSelectParser.java:675)
at com.alibaba.druid.sql.parser.SQLSelectParser.query(SQLSelectParser.java:294)
at com.alibaba.druid.sql.parser.SQLSelectParser.query(SQLSelectParser.java:236)
at com.alibaba.druid.sql.parser.SQLSelectParser.select(SQLSelectParser.java:88)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseSelect(SQLStatementParser.java:2562)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:248)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:171)
at com.alibaba.druid.sql.SQLUtils.parseStatements(SQLUtils.java:495)

Error Info

No response

@lingo-xp
Copy link
Collaborator

升级版本

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