sql icon indicating copy to clipboard operation
sql copied to clipboard

[BUG] JDBC driver forces SQL plugin to use the v1 engine

Open MaxKsyunz opened this issue 3 years ago • 2 comments

What is the bug? Users of the JDBC driver cannot make use of new SQL plugin features because queries sent by the JDBC driver by-pass v2 engine and are always executed by the v1 engine.

What is the expected behavior? Queries sent by JDBC driver to be attempted by v2 engine first and only fallback to v1 engine if it uses unsupported SQL features.

What is your host/environment?

  • OpenSearch 2.4.0.0
  • JDBC Driver 1.1.0.1

Do you have any additional context? When JDBC executes a statement, it sets fetch_size parameter to 100. This fails this check here.

MaxKsyunz avatar Oct 08 '22 06:10 MaxKsyunz

I haven't found where this happens, yet when I create a connection fetchSize is 0, but when createStatement is called, the query it generates sets fetch_size to 100.

MaxKsyunz avatar Oct 08 '22 06:10 MaxKsyunz

I found that the same query works fine in DbVisualizer but in IntelliJ Database tool, fetch_size ends up being 100.

The culprit is probably Statement.setFetchSize override. It's a JDBC method that the client can use to control how many rows are fetched in one request. OpenSearch JDBC driver's ends up setting fetch_size in the REST query to value provided to Statement.setFetchSize.

MaxKsyunz avatar Oct 18 '22 05:10 MaxKsyunz