ClickHouse / clickhouse-java

ClickHouse Java Clients & JDBC Driver
https://clickhouse.com
Apache License 2.0
1.45k stars 535 forks source link

When creating a parameterized view using clickhouse-jdbc, a query parsing error occurs #1818

Open com-exem-route7 opened 2 months ago

com-exem-route7 commented 2 months ago

Description

Occasionally, when creating a parameterized view, the query does not get parsed correctly.

Create Parameterized View Statement

CREATE VIEW default.test
AS 
WITH    
    toDateTime({from:String}, 'Asia/Seoul') AS FROM,    
    date_add(FROM, INTERVAL 1 MINUTE) AS TO,    
    {target_id:String} AS TARGET_ID 
SELECT FROM, TO, TARGET_ID

Debug

image

Result

CREATE VIEW default.test
AS 
WITH    
    toDateTime({from:String}, 'Asia/Seoul') AS FROM,    
    date_add(FROM, INTERVAL 1 MINUTE) AS TO,    
    {target_id:String} AS TARGET_ID 
SELECT FROM, TO, TARGET_ID
;

SELECT * 
FROM system.query_log 
WHERE 
    event_date = '2024-09-10' 
    AND event_time >= toDateTime('2024-09-10 16:14:00', 'Asia/Seoul') 
    AND user = 'admin'
;

image

mohaidoss commented 2 days ago

Up ;)