clickhouse-java icon indicating copy to clipboard operation
clickhouse-java copied to clipboard

max_query_size parameter not passed along

Open basimons opened this issue 2 years ago • 7 comments

Hello,

I'm updating the jbdc driver to version 0.3.2-patch11 (Java 17).

However, I am not able to add the max_query_size parameter. In the earlier version this can be easily done by setting the ClichouseProperties class, but this one has been removed. I tried to convert it to the new way to to check it by doing: SELECT * FROM system.processes FORMAT Vertical. However, whatever I try I can't seem to get it work. My setup looks like this:

 String jdbcUrl = "jdbc:clickhouse://" + clickHouseProperties.getHost() + ":" + clickHouseProperties.getPort()
                + "?socket_timeout=" + clickHouseProperties.getSocketTimeout()
                + "&max_query_size=100000"
                + "&max_result_rows=" + clickHouseProperties.getMaxQuerySize()
                + "&custom_settings="
                + "max_query_size%3D1500000";

Which outputs: Settings {'load_balancing':'random','max_result_rows':'10000000','result_overflow_mode':'break'}

As you can see the max_result_rows is working as expected. I tried both in the above example to double check I'm not doing it wrong.

Is this a bug, or am i doing something wrong?

Thanks in advance!

basimons avatar Feb 06 '23 12:02 basimons

Anybody any idea? I have tried everything that I can think of, but am not able to get the max_query_size to show up int the Settings row of the system.processes table.

basimons avatar Feb 14 '23 11:02 basimons

Hi @basimons, sorry for late response. custom_settings was supported since v0.4.0 but you're trying 0.3.2. Let me check.

zhicwu avatar Feb 14 '23 11:02 zhicwu

Just tried and custom_settings works in v0.4.0. In v0.3.2-patch11, please use custom_http_params instead. As you can tell from the option name, it's tied to http protocol hence not working for grpc and tcp.

zhicwu avatar Feb 14 '23 11:02 zhicwu

Ah ok, that makes sense. Thank you very much for you help.

I do have another (maybe stupid) follow up question:

When I apply this:

String jdbcUrl = "jdbc:clickhouse://" + clickHouseProperties.getHost() + ":" + clickHouseProperties.getPort()
                + "?"
                + ClickHouseConnectionSettings.SOCKET_TIMEOUT.getKey() + "=" + clickHouseProperties.getSocketTimeout()
                + "&"
                + "custom_http_params" // In 4.0 custom_settings should be used
                + "="
                + ClickHouseQueryParam.COMPRESS.getKey() + EQUALS_SIGN_ENCODED + "true";
//                + ClickHouseQueryParam.MAX_QUERY_SIZE.getKey() + EQUALS_SIGN_ENCODED + ClickHouseProperties.getMaxQuerySize();

Which doesn't work as I get an error: java.sql.SQLException: Reached end of input stream after reading 12 of 119 bytes . However, when I switch the lines:

String jdbcUrl = "jdbc:clickhouse://" + clickHouseProperties.getHost() + ":" + clickHouseProperties.getPort()
                + "?"
                + ClickHouseConnectionSettings.SOCKET_TIMEOUT.getKey() + "=" + clickHouseProperties.getSocketTimeout()
                + "&"
                + "custom_http_params" // In 4.0 custom_settings should be used
                + "="
                + ClickHouseQueryParam.MAX_QUERY_SIZE.getKey() + EQUALS_SIGN_ENCODED + clickHouseProperties.getMaxQuerySize();
//                + ClickHouseQueryParam.COMPRESS.getKey() + EQUALS_SIGN_ENCODED + "true";

It works as expected.

It also doesn't work when I try to add the COMPRESS one after this (by using an url encoded comma), I get the same error.

basimons avatar Feb 14 '23 12:02 basimons

Hmm, weird, seems like doing "compress=1" gives the same error, but doing "compress=0" works just fine.

How should I encode a positive value for compress?

basimons avatar Feb 15 '23 11:02 basimons

Also FYI, I tried this in 0.4.0 with custom_settings (with http) and it does not work. It does work fine with custom_http_params.

basimons avatar Feb 15 '23 13:02 basimons

This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!

github-actions[bot] avatar Jun 19 '25 00:06 github-actions[bot]

This issue has been automatically closed because it has not had any further activity in the last 30 days. Thank you for your contributions!

github-actions[bot] avatar Jul 20 '25 00:07 github-actions[bot]