metabase-clickhouse-driver icon indicating copy to clipboard operation
metabase-clickhouse-driver copied to clipboard

Additional JDBC options not apply

Open sergeymong opened this issue 4 years ago • 3 comments

By default, our user costs 10 million lines per read. But for certain groups of users we extend this with the parameter max_rows_to_read.

Now we use Redash, and it works fine there. But here in Metabase, with the same user, the same request and the same period, we catch the error of the request limit. If you look at traceback, it's the same:

"ClickHouse exception, code: 158, host: ch-analytics.amazon, port: 8123; Code: 158, e.displayText() = DB::Exception: Limit for rows to read (or to read), maximum: 10000000 (version 19.7.3.1)\n",
:cause {:class java.lang.Throwable, :error "Code: 158, e.displayText() = DB::Exception: Limit for rows to read exceeded: 13254656 rows read (or to read), maximum: 10000000 (version 19.7.3.1)\n".

That is, you can see that despite the fact that max_rows_to_read=200000000 is written in Additional JDBC Options, it does not work.

sergeymong avatar Mar 12 '20 09:03 sergeymong

You are right. The JDBC driver distinguishes between connection properties and query parameters, but we should be able to fix this.

It suspect that this is not a defect of the driver, but a limitation of the JDBC driver: The option max_rows_to_read is obviously not supported by it, see ClickHouseQueryParam.

I just tried to pass the session_id option, which works fine (shows up in your server logs).

enqueue avatar Jun 16 '20 18:06 enqueue

@zhicwu do you know the rationale behind which options are supported in ClickHouseQueryParam and which ones aren't?

enqueue avatar Dec 08 '21 13:12 enqueue

@zhicwu do you know the rationale behind which options are supported in ClickHouseQueryParam and which ones aren't?

ClickHouseQueryParam is outdated and many settings are missing there. I saw a few pull requetss in the past trying to add specific settings they need but it's far from a "full" list. That's why I added custom_http_params in the new JDBC driver to let people to customize whatever setting they'd like to add, for example: jdbc:ch://localhost?custom_http_params=max_rows_to_read%3D1000%26max_result_rows%3D100. Of course it currently only supports http protocol and won't work if you switch to grpc.

zhicwu avatar Dec 09 '21 09:12 zhicwu

duplicate #85 -- please follow that issue

enqueue avatar Aug 24 '22 14:08 enqueue