Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java] Flight SQL JDBC driver stops receiving RecordBatches when it encounters one empty RecordBatch. #36912

Closed
joao-p-pereira opened this issue Jul 27, 2023 · 2 comments · Fixed by #38590

Comments

@joao-p-pereira
Copy link

Describe the bug, including details regarding any error messages, version, and platform.

When reading the result of a query that returns more than one RecordBatch, if it encounters an empty one, it appears to stop the reading process. However, in reality, there is still data present in the subsequent record batches. We tested this behavior using the driver with SQuirreL SQL Client and a Java program, and the result was the same.

We have an internal Flight SQL command-line client built in Rust, which allows us to validate this observation. When we run the example query below, we can see that there are empty RecordBatches, but there are subsequent RecordBatches that contain data.

> query "select city from csv1 union select city from csv3"
+------+
| city |
+------+
+------+
+------+
| city |
+------+
+------+
+------+
| city |
+------+
+------+
+------+
| city |
+------+
+------+
+------+
| city |
+------+
+------+
+-------+
| city  |
+-------+
| Porto |
+-------+
+--------+
| city   |
+--------+
| Lisboa |
+--------+
+------+
| city |
+------+
+------+

Version:
flight-sql-jdbc-driver version 11.0.0

Component(s)

Java

@lidavidm lidavidm changed the title Flight sql jdbc driver stops receiving RecordBatches when it encounters one empty RecordBatch. [Java] Flight SQL JDBC driver stops receiving RecordBatches when it encounters one empty RecordBatch. Jul 27, 2023
@jduo
Copy link
Member

jduo commented Oct 31, 2023

While working on another issue, it looks as though the driver evaluates FlightStream#getRoot()#getRowCount() > 0 as a stopping condition rather than evaluating FlightStream#next() or FlightStream#hasRoot().

@jduo
Copy link
Member

jduo commented Nov 3, 2023

take

jduo added a commit to Bit-Quill/arrow that referenced this issue Nov 5, 2023
jduo added a commit to Bit-Quill/arrow that referenced this issue Nov 6, 2023
lidavidm pushed a commit that referenced this issue Nov 6, 2023
…y root (#38590)

### Rationale for this change
The JDBC driver for Flight SQL incorrectly stops iterating on a FlightStream if it encounters an empty root.

### What changes are included in this PR?
The driver now waits until FlightStream#next() returns false to determine if a FlightStream is fully-consumed instead of an empty root.

### Are these changes tested?
Yes, new tests have been written.

### Are there any user-facing changes?
No
* Closes: #36912

Authored-by: James Duong <[email protected]>
Signed-off-by: David Li <[email protected]>
@lidavidm lidavidm added this to the 15.0.0 milestone Nov 6, 2023
JerAguilon pushed a commit to JerAguilon/arrow that referenced this issue Nov 9, 2023
…n empty root (apache#38590)

### Rationale for this change
The JDBC driver for Flight SQL incorrectly stops iterating on a FlightStream if it encounters an empty root.

### What changes are included in this PR?
The driver now waits until FlightStream#next() returns false to determine if a FlightStream is fully-consumed instead of an empty root.

### Are these changes tested?
Yes, new tests have been written.

### Are there any user-facing changes?
No
* Closes: apache#36912

Authored-by: James Duong <[email protected]>
Signed-off-by: David Li <[email protected]>
loicalleyne pushed a commit to loicalleyne/arrow that referenced this issue Nov 13, 2023
…n empty root (apache#38590)

### Rationale for this change
The JDBC driver for Flight SQL incorrectly stops iterating on a FlightStream if it encounters an empty root.

### What changes are included in this PR?
The driver now waits until FlightStream#next() returns false to determine if a FlightStream is fully-consumed instead of an empty root.

### Are these changes tested?
Yes, new tests have been written.

### Are there any user-facing changes?
No
* Closes: apache#36912

Authored-by: James Duong <[email protected]>
Signed-off-by: David Li <[email protected]>
dgreiss pushed a commit to dgreiss/arrow that referenced this issue Feb 19, 2024
…n empty root (apache#38590)

### Rationale for this change
The JDBC driver for Flight SQL incorrectly stops iterating on a FlightStream if it encounters an empty root.

### What changes are included in this PR?
The driver now waits until FlightStream#next() returns false to determine if a FlightStream is fully-consumed instead of an empty root.

### Are these changes tested?
Yes, new tests have been written.

### Are there any user-facing changes?
No
* Closes: apache#36912

Authored-by: James Duong <[email protected]>
Signed-off-by: David Li <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants