birschick-bq commented on code in PR #2540:
URL: https://github.com/apache/arrow-adbc/pull/2540#discussion_r1974075907
##########
csharp/src/Drivers/Apache/Hive2/HiveServer2Reader.cs:
##########
@@ -80,6 +82,12 @@ public HiveServer2Reader(
_dataTypeConversion = dataTypeConversion;
}
+ public bool EnableBatchSizeStopCondition
Review Comment:
Resolved. Pass in indicator on constructor, and save in private variable.
Constructor's default is `true` (more efficient test condition) that applies to
2 of the 3 drivers.
##########
csharp/src/Drivers/Apache/Hive2/HiveServer2HttpConnection.cs:
##########
@@ -0,0 +1,342 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Net.Security;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Apache.Arrow.Ipc;
+using Apache.Hive.Service.Rpc.Thrift;
+using Thrift;
+using Thrift.Protocol;
+using Thrift.Transport;
+
+namespace Apache.Arrow.Adbc.Drivers.Apache.Hive2
+{
+ internal class HiveServer2HttpConnection : HiveServer2Connection
+ {
+ private const string ProductVersionDefault = "1.0.0";
+ private const string DriverName = "ADBC Hive Driver";
+ private const string ArrowVersion = "1.0.0";
+ private const string BasicAuthenticationScheme = "Basic";
+ private readonly Lazy<string> _productVersion;
+ private static readonly string s_userAgent = $"{DriverName.Replace("
", "")}/{ProductVersionDefault}";
+
+ protected override string GetProductVersionDefault() =>
ProductVersionDefault;
+
+ protected override string ProductVersion => _productVersion.Value;
+
+ public HiveServer2HttpConnection(IReadOnlyDictionary<string, string>
properties) : base(properties)
+ {
+ ValidateProperties();
+ _productVersion = new Lazy<string>(() => GetProductVersion(),
LazyThreadSafetyMode.PublicationOnly);
+ }
+
+ private void ValidateProperties()
+ {
+ ValidateAuthentication();
+ ValidateConnection();
+ ValidateOptions();
+ }
+
+ private void ValidateAuthentication()
+ {
+ // Validate authentication parameters
+ Properties.TryGetValue(AdbcOptions.Username, out string? username);
+ Properties.TryGetValue(AdbcOptions.Password, out string? password);
+ Properties.TryGetValue(HiveServer2Parameters.AuthType, out string?
authType);
+ bool isValidAuthType =
HiveServer2AuthTypeParser.TryParse(authType, out HiveServer2AuthType
authTypeValue);
+ switch (authTypeValue)
+ {
+ case HiveServer2AuthType.Basic:
+ if (string.IsNullOrWhiteSpace(username) ||
string.IsNullOrWhiteSpace(password))
+ throw new ArgumentException(
+ $"Parameter '{HiveServer2Parameters.AuthType}' is
set to '{HiveServer2AuthTypeConstants.Basic}' but parameters
'{AdbcOptions.Username}' or '{AdbcOptions.Password}' are not set. Please
provide a values for these parameters.",
+ nameof(Properties));
+ break;
+ case HiveServer2AuthType.UsernameOnly:
+ if (string.IsNullOrWhiteSpace(username))
+ throw new ArgumentException(
+ $"Parameter '{HiveServer2Parameters.AuthType}' is
set to '{HiveServer2AuthTypeConstants.UsernameOnly}' but parameter
'{AdbcOptions.Username}' is not set. Please provide a values for this
parameter.",
+ nameof(Properties));
+ break;
+ case HiveServer2AuthType.None:
+ break;
+ case HiveServer2AuthType.Empty:
+ if (string.IsNullOrWhiteSpace(username) ||
string.IsNullOrWhiteSpace(password))
+ throw new ArgumentException(
+ $"Parameters must include valid authentiation
settings. Please provide '{AdbcOptions.Username}' and
'{AdbcOptions.Password}'.",
Review Comment:
Resolved.
--
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]