Skip to content

Conversation

@jadewang-db
Copy link
Contributor

Summary

  • Fixed failing unit tests in CloudFetchResultFetcherTest by correcting the conditional logic for processing initial results
  • The fetcher now properly handles initial results regardless of the HasDirectResults flag state

Problem

Two unit tests were failing:

  • InitialResults_ProcessesInitialResultsCorrectly
  • InitialResults_WithMoreRows_ContinuesFetching

The issue was in the condition that checks whether to process direct/initial results. The previous logic required
_statement.HasDirectResults to be true even when processing initial results passed to the constructor, which
prevented the initial results from being processed in test scenarios.

Solution

Changed the conditional logic from:

if (_statement.HasDirectResults &&
    (_statement.DirectResults?.ResultSet?.Results?.ResultLinks?.Count > 0 ||
    _initialResults?.Results?.ResultLinks?.Count > 0))

To:
if ((_statement.HasDirectResults && _statement.DirectResults?.ResultSet?.Results?.ResultLinks?.Count > 0) ||
    _initialResults?.Results?.ResultLinks?.Count > 0)

This ensures that initial results are processed when provided, regardless of the HasDirectResults flag.

Test plan

- All 12 tests in CloudFetchResultFetcherTest pass
- No regression in other CloudFetch-related tests
- Verified the fetcher correctly processes both direct results and initial results scenarios

…al results processing logic

  ## Summary
  - Fixed failing unit tests in CloudFetchResultFetcherTest by correcting the conditional logic for processing
  initial results
  - The fetcher now properly handles initial results regardless of the `HasDirectResults` flag state

  ## Problem
  Two unit tests were failing:
  - `InitialResults_ProcessesInitialResultsCorrectly`
  - `InitialResults_WithMoreRows_ContinuesFetching`

  The issue was in the condition that checks whether to process direct/initial results. The previous logic required
  `_statement.HasDirectResults` to be true even when processing initial results passed to the constructor, which
  prevented the initial results from being processed in test scenarios.

  ## Solution
  Changed the conditional logic from:
  ```csharp
  if (_statement.HasDirectResults &&
      (_statement.DirectResults?.ResultSet?.Results?.ResultLinks?.Count > 0 ||
      _initialResults?.Results?.ResultLinks?.Count > 0))

  To:
  if ((_statement.HasDirectResults && _statement.DirectResults?.ResultSet?.Results?.ResultLinks?.Count > 0) ||
      _initialResults?.Results?.ResultLinks?.Count > 0)

  This ensures that initial results are processed when provided, regardless of the HasDirectResults flag.

  Test plan

  - All 12 tests in CloudFetchResultFetcherTest pass
  - No regression in other CloudFetch-related tests
  - Verified the fetcher correctly processes both direct results and initial results scenarios
@github-actions github-actions bot modified the milestone: ADBC Libraries 20 Jul 3, 2025
@CurtHagenlocher CurtHagenlocher merged commit f8d5a5c into apache:main Jul 3, 2025
7 checks passed
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