lidavidm commented on code in PR #41237:
URL: https://github.com/apache/arrow/pull/41237#discussion_r1604190653
##########
java/flight/flight-sql/src/main/java/org/apache/arrow/flight/sql/FlightSqlClient.java:
##########
@@ -1048,15 +1049,35 @@ private Schema deserializeSchema(final ByteString
bytes) {
public FlightInfo execute(final CallOption... options) {
checkOpen();
- final FlightDescriptor descriptor = FlightDescriptor
+ FlightDescriptor descriptor = FlightDescriptor
.command(Any.pack(CommandPreparedStatementQuery.newBuilder()
.setPreparedStatementHandle(preparedStatementResult.getPreparedStatementHandle())
.build())
.toByteArray());
if (parameterBindingRoot != null && parameterBindingRoot.getRowCount() >
0) {
- try (final SyncPutListener listener = putParameters(descriptor,
options)) {
- listener.getResult();
+ try (final SyncPutListener putListener = putParameters(descriptor,
options)) {
+ if (getParameterSchema().getFields().size() > 0 &&
+ parameterBindingRoot != null &&
+ parameterBindingRoot.getRowCount() > 0) {
+ final PutResult read = putListener.read();
+ if (read != null) {
+ try (final ArrowBuf metadata = read.getApplicationMetadata()) {
+ final FlightSql.DoPutPreparedStatementResult
doPutPreparedStatementResult =
+
FlightSql.DoPutPreparedStatementResult.parseFrom(metadata.nioBuffer());
+ descriptor = FlightDescriptor
+
.command(Any.pack(CommandPreparedStatementQuery.newBuilder()
+ .setPreparedStatementHandle(
+
doPutPreparedStatementResult.getPreparedStatementHandle())
+ .build())
+ .toByteArray());
+ }
+ }
+ }
+ } catch (final InterruptedException | ExecutionException e) {
Review Comment:
wouldn't we want to unpack an ExecutionException instead of rewrapping it?
--
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]