yucheng-du commented on code in PR #1547:
URL: https://github.com/apache/arrow-java/pull/1547#discussion_r4793387015


##########
flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/utils/FlightEndpointDataQueue.java:
##########
@@ -183,7 +183,8 @@ public synchronized void enqueue(final 
CloseableEndpointStreamPair endpointReque
             () -> {
               // `FlightStream#next` will block until new data can be read or 
stream is over.
               while (endpointRequest.getStream().next()) {
-                if (endpointRequest.getStream().getRoot().getRowCount() > 0) {
+                if (endpointRequest.getStream().getLatestMetadata() != null

Review Comment:
   I tried the proposed EOF check with two local Flight endpoints. One sent 
only a trailer (byte 99), and the other delayed its first row. 
`FlightStream.next()` retained the trailer after EOF. With the existing 
re-enqueue in `ResultSet.next()`, the queue handed back the same exhausted 
endpoint three times. Each time `next()` returned false and the metadata was 
still 99.
   
   Even a one-time handoff of that empty endpoint can finish the timed wait 
before the other endpoint supplies a row. Capturing the trailer separately 
would let the queue keep waiting for the first row or for all endpoints to 
finish. The timeout can then be tested independently of the public API for 
intermediate metadata.
   



-- 
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]

Reply via email to