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

c.c.jdbc.parser.ClickHouseSqlParser - Parse error #2009

Open
KeKeValue opened this issue Dec 10, 2024 · 5 comments
Open

c.c.jdbc.parser.ClickHouseSqlParser - Parse error #2009

KeKeValue opened this issue Dec 10, 2024 · 5 comments
Labels

Comments

@KeKeValue
Copy link

KeKeValue commented Dec 10, 2024

c.c.jdbc.parser.ClickHouseSqlParser - Parse error at line 1, column 47. Encountered: ?. If you believe the SQL is valid, please feel free to open an issue on Github with this warning and the following SQL attached.
TRUNCATE TABLE shanhu_subject_info on cluster ?

@KeKeValue
Copy link
Author

KeKeValue commented Dec 10, 2024

In my Spring Boot project, I am using ClickHouse to first clear the table data and then insert data into it. However, when executing the statement to clear the table, I received a "Parse error."
Here is the code:
Call site: xxMapper.truncate(clusterName);
MyBatis mapper interface method: void truncate(String clusterName);
MyBatis XML file:

TRUNCATE TABLE shanhu_subject_info on cluster #{clusterName}

Configuration details: .yml
clickhouse:
url: jdbc:clickhouse://ip:8123/database_name
username: user
password: pwd
driver-class-name: com.clickhouse.jdbc.ClickHouseDriver

@chernser chernser added bug module-jdbc JDBC driver labels Dec 10, 2024
@chernser
Copy link
Contributor

Good day, @KeKeValue !
What is the exact SQL statement?
Just in the first message it is with ? and in the last it is with name parameter #{clusterName}
I would appreciate if you can give an example code that fails.

Thanks!

@KeKeValue
Copy link
Author

My intention is to clear the data of one local table on a specific ClickHouse cluster. So, I executed the following SQL:
TRUNCATE TABLE shanhu_subject_info ON CLUSTER #{clusterName}
The value for the SQL placeholder #{clusterName} is configured in the configuration file, and the value corresponds to the actual ClickHouse cluster name.

@KeKeValue
Copy link
Author

Since the cluster names are different in each environment, I have configured the corresponding cluster names in the configuration files for both QAS and PRD environments. When executing the SQL, I use a placeholder to dynamically select the appropriate cluster name for QAS or PRD environments.

@KeKeValue
Copy link
Author

@chernser brother, can you help me take a look at this issue

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

No branches or pull requests

2 participants