Skip to content

fix(bq_driver): HTAPI fetch results fix when table is empty#1594

Open
KanchanShu wants to merge 1 commit into
mainfrom
SQLExec_emptyTable_issue_fix
Open

fix(bq_driver): HTAPI fetch results fix when table is empty#1594
KanchanShu wants to merge 1 commit into
mainfrom
SQLExec_emptyTable_issue_fix

Conversation

@KanchanShu

@KanchanShu KanchanShu commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix the HTAPI execution path for queries that return an empty result set. Previously, reaching the end of the HTAPI read stream during execution could return SQL_NO_DATA prematurely. This change aligns HTAPI behavior with the existing non-HTAPI flow.

Changes

  • Updated ReadNextResultsFromStream() to:

    • Treat end-of-stream as a successful completion during execution.
    • Clear the cached result set and reset the cursor for empty results.
    • Avoid returning SQL_NO_DATA during execution.
  • Preserve SQL_NO_DATA generation in the fetch path (FetchNextResultSet()), so it is returned by SQLFetch() when no rows are available.

  • Added a test for an empty result set (WHERE 1=2) to verify successful execution and results.size() == 0.

Behavior

Before

  • HTAPI could return SQL_NO_DATA during execution for empty result sets.

After

  • SQLExecDirect/SQLExecute succeeds for empty result sets.
  • SQLFetch returns SQL_NO_DATA when no rows are available.
  • Empty queries return results.size() == 0, matching the non-HTAPI behavior.

@shivamd-gpartner
shivamd-gpartner marked this pull request as ready for review July 16, 2026 06:44
@shivamd-gpartner
shivamd-gpartner requested a review from a team as a code owner July 16, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants