fix(go): process URI before other options to avoid nondeterminism#142
Closed
ewgenius wants to merge 1 commit intoadbc-drivers:mainfrom
Closed
fix(go): process URI before other options to avoid nondeterminism#142ewgenius wants to merge 1 commit intoadbc-drivers:mainfrom
ewgenius wants to merge 1 commit intoadbc-drivers:mainfrom
Conversation
|
✔️ Test passed: spiceai/bigquery@22ea9bc |
lidavidm
approved these changes
Mar 25, 2026
lidavidm
approved these changes
Mar 25, 2026
Contributor
Contributor
|
GitHub still won't let me merge this. @ewgenius do you mind re-creating the PR? |
lidavidm
approved these changes
Mar 26, 2026
Contributor
Author
|
@lidavidm sure, I'll recreate |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
When
BigQueryDatabaseInitis called with both auriand explicit auth options (e.g.adbc.bigquery.sql.auth_type,adbc.bigquery.sql.auth_credentials), the connection intermittently fails with:The failure is non-deterministic - the same set of options may succeed on one call and fail on the next.
Root cause:
databaseImpl.SetOptionsiterates amap[string]string, which has non-deterministic order in Go."uri"is the only macro key in the options set -ParseBigQueryURIToParamsexpands it into multiple fields and unconditionally setsauth_type = ADCwhen the URI contains noOAuthTypequery parameter (e.g. a plainbigquery:///project-id). All other keys are simple independent field writes. When the map iteration happened to visit"uri"after the explicit auth options, the URI parser silently overwrote the caller'sauth_typeback to ADC.newClient()then skipped the provided credentials entirely and fell through to Application Default Credentials discovery.Solution
Fix
SetOptionsto always process"uri"first, before iterating the rest of the options. Since"uri"is the only key with expansion side-effects, this single ordering guarantee is sufficient - all other keys are independent field writes and their relative order does not matter.ParseBigQueryURIToParamsis unchanged: a URI withoutOAuthTypestill correctly defaults to ADC for callers who provide only a URI with no explicit auth options.