ClickHouse / clickhouse-java

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

Socket timeout being used as Future wait #1783

Open kuhnen opened 3 weeks ago

kuhnen commented 3 weeks ago

In the ClickhouseClient file, specifically on line 878, the following code is present:

return execute(sealedRequest).get(sealedRequest.getConfig().getSocketTimeout(), TimeUnit.MILLISECONDS);

return execute(sealedRequest).get(sealedRequest.getConfig().getSocketTimeout(), TimeUnit.MILLISECONDS); I have encountered an issue where there appears to be no way to override this setting when using the spark-clickhouse-connector.

Would it be possible to introduce a method to override this parameter, perhaps through an environment variable? Additionally, it would be beneficial to consider renaming the property, as its current name (socket_timeout) does not accurately reflect its functionality.

chernser commented 3 weeks ago

Good day, @kuhnen ! Is it possible to use Future method like

request.query(sql).execute().get(timeout, TimeUnit.MILLISECONDS);

I'm referring to this method com.clickhouse.client.ClickHouseRequest#execute

Thanks!

kuhnen commented 2 weeks ago

Good day, @chernser! :)

Thank you for your response.

I understand your suggestion and have already created a fork and deployed a local jar to work with the spark-clickhouse-connector. However, I’m wondering if it might be possible to introduce a solution that allows this timeout value to be configured via an environment variable or a configuration file.

Additionally, I’m curious if the name socket_timeout is the best fit for this property, considering its usage in this context. Perhaps renaming it to something more indicative of its purpose could be beneficial.

Thanks again for your support!