stevelorddremio commented on code in PR #42035:
URL: https://github.com/apache/arrow/pull/42035#discussion_r1633731201
##########
java/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/client/ArrowFlightSqlClientHandler.java:
##########
@@ -254,6 +276,21 @@ public interface PreparedStatement extends AutoCloseable {
* @return a new prepared statement.
*/
public PreparedStatement prepare(final String query) {
+ if (hasCatalog()) {
+ final SetSessionOptionsRequest setSessionOptionRequest =
+ new SetSessionOptionsRequest(ImmutableMap.<String,
SessionOptionValue>builder()
+ .put(CATALOG,
SessionOptionValueFactory.makeSessionOptionValue(catalog))
+ .build());
+ final SetSessionOptionsResult result =
sqlClient.setSessionOptions(setSessionOptionRequest, getOptions());
+ if (result.hasErrors()) {
+ Map<String, SetSessionOptionsResult.Error> errors = result.getErrors();
+ for (Map.Entry<String, SetSessionOptionsResult.Error> error :
errors.entrySet()) {
+ LOGGER.warn(error.toString());
+ }
+ throw new RuntimeException(String.format("Cannot set session option
for catalog = %s", catalog));
Review Comment:
SQLException looks more appropriate but that can't be propagated back to the
client as this ultimately is not defined by the Calcite interface.
I've used a FlightRuntimeException instead. Let me know if this doesn't
align with what you were thinking.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]