You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "scruz-denodo (via GitHub)" <gi...@apache.org> on 2026/10/20 08:03:50 UTC
[I] Flight SQL JDBC driver: support client-side prepared statements for servers that cannot prepare or bind parameters [arrow-java]
scruz-denodo opened a new issue, #1375:
URL: https://github.com/apache/arrow-java/issues/1375
### Describe the enhancement requested
# Describe the enhancement requested
The Flight SQL JDBC driver always prepares a statement on the server and binds its parameters. It can exists servers implementing Flight SQL connection interface which do not support the parameters binding process.
- they do not implement `CreatePreparedStatement`, or
- they can prepare a statement but cannot bind its parameters .
In those cases, the usage of `PreparedStatements` is not 100% usable.
One of the main problems of this is that thirdparty-tools using the JDBC driver usually make use of `PreparedStatement` classes and there is no way for overriding that behavior.
I have changes which I think they can be useful for this. They consist on adding an optional mode in which the driver handles `PreparedStatement ` on the client side:
- It keeps the statement text.
- It writes the parameter values into it as SQL literals, using a pluggable `SqlDialect`.
- It runs the result as a plain query or update.
Statements prepared on the server keep their current behavior, and the default behavior does not change.
## Proposed design
### Connection properties
- `disableServerPreparedStatements`: No statement is prepared on the server. (disabled by default, so the current behavior is the default)
- `disableServerPreparedQueries`: Only queries are handled on the client. Updates with parameters are still prepared on the server.
- `dialect `/ `dialectClass`: The SQL dialect used to write literals, chosen by name through a registry or by class.
- `clientSideMetadataProbe`: Whether the first getMetaData() call asks the server for the result columns.
### Dialects
- `SqlDialect` is an interface in which every method has an ANSI SQL default, so a dialect overrides only what its database does differently.
- It is discovered through `ServiceLoader` and a `SqlDialectRegistry`.
- It covers literals for strings, numbers, binary values, dates, times, timestamps, intervals, ``, arrays and rows.
- It classifies a statement as query or update by its first keyword.
- It produces the metadata probe by replacing every parameter marker with NULL.
- A default `AnsiSqlDialect` which keeps all the defaults.
- `SqlParameterScanner `finds the `?` markers outside string literals, quoted identifiers and comments. Dialects can tune it with lexical rules, for example // comments.
### Value conversion
`SqlValueFactory` turns what JDBC and Avatica hand over for a parameter into a small value model. The dialect implementations then deals with one representation.
This issue is related with [issue-62](https://github.com/apache/arrow-java/issues/62).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Flight SQL JDBC driver: support client-side prepared statements for servers that cannot prepare or bind parameters [arrow-java]
Posted by "scruz-denodo (via GitHub)" <gi...@apache.org>.
scruz-denodo commented on issue #1375:
URL: https://github.com/apache/arrow-java/issues/1375#issuecomment-6294811405
Understood.
As an additional comment, the support to include here could be only the `SqlDialect` interface, connection properties and discovery support for dialects.
So thirdparty users can make their own dialects injecting them at execution time. So, no real SQL rewriting would be present at the driver.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Flight SQL JDBC driver: support client-side prepared statements for servers that cannot prepare or bind parameters [arrow-java]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1375:
URL: https://github.com/apache/arrow-java/issues/1375#issuecomment-6289308007
Sorry, but I _really_ don't like this: I don't want to be in the business of rewriting SQL.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org