ClickHouse/clickhouse-jdbc-bridge

Query not being parsed correctly

WesleyBatista opened this issue · 3 comments

Seems like the latest release introduced a bug:

SELECT `id` FROM `public`.`test_table`
Normalized query:
test_table
2021-09-30 09:32:30.030 [vert.x-worker-thread-10] [DEBUG] {ResponseWriter:45} - Start Time=1632994350871, Timeout=-1000, Max Block Size=65505
2021-09-30 09:32:30.030 [vert.x-eventloop-thread-0] [ERROR] {JdbcBridgeVerticle:320} - Failed to respond
java.lang.IllegalArgumentException: At least one column is needed.
        at ru.yandex.clickhouse.jdbcbridge.core.TableDefinition.<init>(TableDefinition.java:86)
        at ru.yandex.clickhouse.jdbcbridge.core.TableDefinition.fromString(TableDefinition.java:371)
        at ru.yandex.clickhouse.jdbcbridge.core.QueryParser.getTable(QueryParser.java:118)
        at ru.yandex.clickhouse.jdbcbridge.JdbcBridgeVerticle.handleQuery(JdbcBridgeVerticle.java:473)
        at ru.yandex.clickhouse.jdbcbridge.internal.vertx.ext.web.impl.BlockingHandlerDecorator.lambda$handle$0(BlockingHandlerDecorator.java:48)
        at ru.yandex.clickhouse.jdbcbridge.internal.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:313)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at ru.yandex.clickhouse.jdbcbridge.internal.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)

Happens on v2.0.5, using postgres driver 42.2.24

Downgrading to v2.0.4 solved the issue

Thanks @WesleyBatista for reporting the issue. Sorry I only tested on 21.6+. I can reproduce the issue on 20.8 and 21.3.

Anyway, I'll submit a PR to fix the issue shortly, and I'll add some more tests in next following days before releasing 2.0.6.

Please try 2.0.6. It should work for 20.8 and 21.3 as well.

I forgot to mention clickhouse version, which is 21.1.9.41.

2.0.6 fixed the problem.

@zhicwu, thanks! 😄