alexguo-db commented on code in PR #3177:
URL: https://github.com/apache/arrow-adbc/pull/3177#discussion_r2220274834
##########
csharp/src/Drivers/Databricks/DatabricksConnection.cs:
##########
@@ -334,44 +336,78 @@ protected override HttpMessageHandler CreateHttpHandler()
baseHandler = new RetryHttpHandler(baseHandler,
TemporarilyUnavailableRetryTimeout);
}
- // Add OAuth handler if OAuth authentication is being used
+ // Add OAuth client credentials handler if OAuth M2M
authentication is being used
if (Properties.TryGetValue(SparkParameters.AuthType, out string?
authType) &&
SparkAuthTypeParser.TryParse(authType, out SparkAuthType
authTypeValue) &&
authTypeValue == SparkAuthType.OAuth &&
Properties.TryGetValue(DatabricksParameters.OAuthGrantType,
out string? grantTypeStr) &&
DatabricksOAuthGrantTypeParser.TryParse(grantTypeStr, out
DatabricksOAuthGrantType grantType) &&
grantType == DatabricksOAuthGrantType.ClientCredentials)
{
- // Note: We assume that properties have already been validated
- if (Properties.TryGetValue(SparkParameters.HostName, out
string? host) && !string.IsNullOrEmpty(host))
- {
- // Use hostname directly if provided
- }
- else if (Properties.TryGetValue(AdbcOptions.Uri, out string?
uri) && !string.IsNullOrEmpty(uri))
- {
- // Extract hostname from URI if URI is provided
- if (Uri.TryCreate(uri, UriKind.Absolute, out Uri?
parsedUri))
- {
- host = parsedUri.Host;
- }
- }
+ string host = GetHost();
Properties.TryGetValue(DatabricksParameters.OAuthClientId, out
string? clientId);
Properties.TryGetValue(DatabricksParameters.OAuthClientSecret,
out string? clientSecret);
Properties.TryGetValue(DatabricksParameters.OAuthScope, out
string? scope);
- HttpClient OauthHttpClient = new
HttpClient(HiveServer2TlsImpl.NewHttpClientHandler(TlsOptions,
_proxyConfigurator));
+ if (_httpClient == null)
Review Comment:
No, it should only be called once per connection.
https://github.com/apache/arrow-adbc/blob/main/csharp/src/Drivers/Databricks/DatabricksDatabase.cs#L43
Specifically, it's called during OpenAsync, which is called right after
initializing the DatabricksConnection
I added the change you suggested
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]