[ 
https://issues.apache.org/jira/browse/ARROW-16035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Krisztian Szucs updated ARROW-16035:
------------------------------------
    Fix Version/s: 8.0.0
                       (was: 9.0.0)

> [Java] Arrow to JDBC ArrowVectorIterator with does not terminate with empty 
> result set
> --------------------------------------------------------------------------------------
>
>                 Key: ARROW-16035
>                 URL: https://issues.apache.org/jira/browse/ARROW-16035
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 7.0.0
>            Reporter: Jonathan Swenson
>            Assignee: Todd Farmer
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 8.0.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Using an ArrowVectorIterator built from a JDBC Result Set that is empty 
> causes the iterator to never terminate. 
> {code:java}
> ArrowVectorIterator iterator =
>     JdbcToArrow.sqlToArrowVectorIterator(conn.createStatement()
>         .executeQuery("select 1 from table1 where false"), config); {code}
>  
> It appears as though this is due to the implementation of the 
> [hasNext()|https://github.com/apache/arrow/blob/master/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/ArrowVectorIterator.java#L158]
>  method.
> The expectation is that the `isAfterLast()` method on a JDBC result set 
> return true when the result set is empty. However, according to the [JDBC 
> documentation|https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/java/sql/ResultSet.html#isAfterLast()]
>  it will always return false when the result set is empty. 
> {quote}Returns:{{{}true{}}} if the cursor is after the last row; {{false}} if 
> the cursor is at any other position or the result set contains no rows
> {quote}
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to