alibaba / druid

阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
https://github.com/alibaba/druid/wiki
Apache License 2.0
27.98k stars 8.58k forks source link

asof join SQLParser报错 #4480

Open liumingy1022 opened 3 years ago

liumingy1022 commented 3 years ago

clickhouse中执行没问题,但解析报错 SELECT DISTINCT u1.user_id FROM (SELECT user_id, reach_time FROM (SELECT user_id, count(1) AS num, min(arrival_time) AS reach_time FROM cdp.component_reach_user_dist WHERE kdt_id = 18116282 AND plan_id = 1601 AND job_id = 1045 AND ((task_id = '482d894b-c9e8-426b-b944-786ba68122a4' AND state = 'SUCCESS')) AND arrival_time >= '2021-09-24 14:55:55' AND arrival_time <= '2021-09-24 14:58:35' GROUP BY user_id) WHERE num % 1 = 0 AND reach_time >= '2021-09-24 14:55:55' AND reach_time <= '2021-09-24 14:58:35') u1 ASOF LEFT JOIN (SELECT toInt64OrZero(yz_uid) AS user_id, event_time FROM cdp.dw_dws_log_display_c_dist WHERE event_time_day >= '20210924' AND event_time_day <= '20210924' AND hq_kdt_id = '18116282' AND dc_ps = 'cdp.plan.componentId_482d894b-c9e8-426b-b944-786ba68122a4' AND event_time >= '2021-09-24 14:55:55' AND event_time <= '2021-09-24 14:58:35') u2 ON u1.user_id = u2.user_id AND toDateTime(u2.event_time) >= toDateTime(u1.reach_time) WHERE u2.user_id = 0

liumingy1022 commented 3 years ago

com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'ASOF LEFT JOIN (SELECT buyer_id A', expect IDENTIFIER, actual IDENTIFIER pos 363, line 1, column 364, token IDENTIFIER null at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:287) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:532) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:171) at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:98) at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:81) at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:54) at com.alibaba.druid.filter.stat.StatFilter.mergeSql(StatFilter.java:147) at com.alibaba.druid.filter.stat.StatFilter.createSqlStat(StatFilter.java:648) at com.alibaba.druid.filter.stat.StatFilter.statementPrepareAfter(StatFilter.java:311) at com.alibaba.druid.filter.FilterEventAdapter.connection_prepareStatement(FilterEventAdapter.java:146) at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:610) at com.alibaba.druid.filter.FilterAdapter.connection_prepareStatement(FilterAdapter.java:943) at com.alibaba.druid.filter.FilterEventAdapter.connection_prepareStatement(FilterEventAdapter.java:143) at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:610) at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.prepareStatement(ConnectionProxyImpl.java:374) at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:388) at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:85) at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88) at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:59) at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:85)