不支持clickhouse 子查询里的 with 语句
- Dominant language
- Java
- Stars
- 28.2k
- Forks
- 8.6k
- PR merge metrics
- No merged PRs in 30d
Description
sql语句:
```sql
SELECT
sum(r[1]) AS r1,
sum(r[2]) AS r2
FROM
(
WITH subtractDays(toDate('2021-01-19'), 1) AS day
SELECT
retention(toDate(created) = day,
toDate(created) = '2021-01-19'
) AS r
FROM user_action_logs
WHERE toDate(created) IN(day, '2021-01-19')
GROUP BY member_id
)
```
错误提示:Cause: java.sql.SQLException: sql injection violation, dbType clickhouse, , druid-version 1.2.4, syntax error: syntax error, error in :'subtractDays(toDate('2021-01-19'), 1) AS da', expect ), actual (, pos 80, line 6, column 26, token ( : SELECT
sum(r[1]) AS r1,
sum(r[2]) AS r2
FROM
(
WITH subtractDays(toDate('2021-01-19'), 1) AS day
SELECT
retention(toDate(created) = day,
toDate(created) = '2021-01-19'
) AS r
FROM user_action_logs
WHERE toDate(created) IN(day, '2021-01-19')
GROUP BY member_id
)
Contributor guide
Research direction
Start by reproducing the supplied ClickHouse SQL and inspect the parser path indicated by the syntax error at the subquery’s WITH expression. Trace existing ClickHouse grammar coverage and add a regression case for this query; done means it is accepted without the reported syntax or SQL-injection violation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clickhouse, java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100