ClickHouse/clickhouse-jdbc-bridge

question - why double execution is needed?

mikeTWC1984 opened this issue · 1 comments

As per documentation:

By default, any adhoc query passed to JDBC bridge will be executed twice. The first run is for type inferring, while the second for retrieving results. Although metadata will be cached(for up to 5 minutes by default), executing same query twice could be a problem - that's where schema comes into play.

Wondering why is that? Doesn't ResultSet contain sufficient metadata info?

Wondering why is that? Doesn't ResultSet contain sufficient metadata info?

Yes, JDBC is all good. The problem is ClickHouse issued two requests for a single query: one for type inferring, which is to figure out what's the result looks like; and the other for query execution. You may check #110 (comment) to understand more.