jswenson points out that the fix for
ARROW-16035 uses the ResultSet.isLast() method, which is listed as optional for vendor support in the (likely common) condition that the result set is forward-scrollable only. This new code replaced dependency on ResultSet.isAfterLast(), which is similarly annotated as optional in the same context (and has the additional challenge of being non-deterministic in the case of empty result sets). To eliminate these dependencies, we propose the following:
- The ArrowVectorIterator returned from processing ResultSets will always have at least one element, meaning hasNext() will return true initially, even in the case of empty ResultSets.
- Calling ArrowVectorIterator.next() will establish whether there is actual data to be supplied, and will return an "empty" VectorSchemaRoot when an empty ResultSet was supplied originally.
- Subsequent calls to ArrowVectorIterator.hasNext() will return false in the case when an empty ResultSet was supplied.
This is a behavior change, in that the current
ARROW-16035-patched code returns false today when an empty ResultSet was supplied, and the JDBC driver optionally implements ResultSet.isLast().