databricks / databricks-sql-go

Golang database/sql driver for Databricks SQL.
Apache License 2.0
37 stars 41 forks source link

Bug fix: The HasNext() function for Go driver arrow record iterator returning EOF for empty result set. #186

Closed rcypher-databricks closed 10 months ago

rcypher-databricks commented 10 months ago

Bug fix: The HasNext() function for Go driver arrow record iterator returning EOF for empty result set.

Essentially, the HasNext() logic was assuming there were records in the result set in the case that the original return from executing the statement didn't specify, or if there were no direct results.

Updated arrowRecordIterator.HasNext() to check state of underlying iterators. This handles the case of direct results that contain no records. Updated resultPageIterator.HasNext() to try fetching a result page if necessary to determine if there are more records.

Added tests for empty result sets with direct results enabled and disabled. Internal ticket: ES-975398