diff --git a/csharp/src/Drivers/Apache/Hive2/HiveServer2Connection.cs b/csharp/src/Drivers/Apache/Hive2/HiveServer2Connection.cs index fc40a19bb0..d07a92a3ef 100644 --- a/csharp/src/Drivers/Apache/Hive2/HiveServer2Connection.cs +++ b/csharp/src/Drivers/Apache/Hive2/HiveServer2Connection.cs @@ -40,6 +40,8 @@ internal abstract class HiveServer2Connection : TracingConnection internal const bool InfoVendorSql = true; internal const long BatchSizeDefault = 50000; internal const int PollTimeMillisecondsDefault = 500; + internal static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(HiveServer2Connection)); + internal static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(HiveServer2Connection)); private const int ConnectTimeoutMillisecondsDefault = 30000; private TTransport? _transport; private TCLIService.IAsync? _client; diff --git a/csharp/src/Drivers/Apache/Hive2/HiveServer2HttpConnection.cs b/csharp/src/Drivers/Apache/Hive2/HiveServer2HttpConnection.cs index c0a33d1de5..b5e21b6e95 100644 --- a/csharp/src/Drivers/Apache/Hive2/HiveServer2HttpConnection.cs +++ b/csharp/src/Drivers/Apache/Hive2/HiveServer2HttpConnection.cs @@ -35,8 +35,6 @@ namespace Apache.Arrow.Adbc.Drivers.Apache.Hive2 internal class HiveServer2HttpConnection : HiveServer2ExtendedConnection { private const string BasicAuthenticationScheme = "Basic"; - private static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(HiveServer2HttpConnection)); - private static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(HiveServer2HttpConnection)); private readonly HiveServer2ProxyConfigurator _proxyConfigurator; diff --git a/csharp/src/Drivers/Apache/Hive2/HiveServer2Reader.cs b/csharp/src/Drivers/Apache/Hive2/HiveServer2Reader.cs index 238066c194..a1e3e6df9c 100644 --- a/csharp/src/Drivers/Apache/Hive2/HiveServer2Reader.cs +++ b/csharp/src/Drivers/Apache/Hive2/HiveServer2Reader.cs @@ -72,8 +72,6 @@ internal class HiveServer2Reader : TracingReader { { ArrowTypeId.Float, ConvertToFloat }, }; - private static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(HiveServer2Reader)); - private static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(HiveServer2Reader)); public HiveServer2Reader( HiveServer2Statement statement, @@ -89,9 +87,9 @@ public HiveServer2Reader( public override Schema Schema { get; } - public override string AssemblyName => s_assemblyName; + public override string AssemblyName => HiveServer2Connection.s_assemblyName; - public override string AssemblyVersion => s_assemblyVersion; + public override string AssemblyVersion => HiveServer2Connection.s_assemblyVersion; public override async ValueTask ReadNextRecordBatchAsync(CancellationToken cancellationToken = default) { diff --git a/csharp/src/Drivers/Apache/Hive2/HiveServer2StandardConnection.cs b/csharp/src/Drivers/Apache/Hive2/HiveServer2StandardConnection.cs index 5bdd65b89b..66f175a147 100644 --- a/csharp/src/Drivers/Apache/Hive2/HiveServer2StandardConnection.cs +++ b/csharp/src/Drivers/Apache/Hive2/HiveServer2StandardConnection.cs @@ -30,9 +30,6 @@ namespace Apache.Arrow.Adbc.Drivers.Apache.Hive2 { internal class HiveServer2StandardConnection : HiveServer2ExtendedConnection { - private static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(HiveServer2StandardConnection)); - private static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(HiveServer2StandardConnection)); - public HiveServer2StandardConnection(IReadOnlyDictionary properties) : base(properties) { } diff --git a/csharp/src/Drivers/Apache/Hive2/HiveServer2Statement.cs b/csharp/src/Drivers/Apache/Hive2/HiveServer2Statement.cs index 3eebb5773d..31bb234b8a 100644 --- a/csharp/src/Drivers/Apache/Hive2/HiveServer2Statement.cs +++ b/csharp/src/Drivers/Apache/Hive2/HiveServer2Statement.cs @@ -49,8 +49,6 @@ internal class HiveServer2Statement : TracingStatement // Add constants for PK and FK field names and prefixes protected static readonly string[] PrimaryKeyFields = new[] { "COLUMN_NAME" }; protected static readonly string[] ForeignKeyFields = new[] { "PKCOLUMN_NAME", "PKTABLE_CAT", "PKTABLE_SCHEM", "PKTABLE_NAME", "FKCOLUMN_NAME", "FK_NAME", "KEQ_SEQ" }; - private static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(HiveServer2Statement)); - private static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(HiveServer2Statement)); protected const string PrimaryKeyPrefix = "PK_"; protected const string ForeignKeyPrefix = "FK_"; @@ -353,9 +351,9 @@ protected internal int QueryTimeoutSeconds // Keep the original Client property for internal use public TCLIService.IAsync Client => Connection.Client; - public override string AssemblyName => s_assemblyName; + public override string AssemblyName => HiveServer2Connection.s_assemblyName; - public override string AssemblyVersion => s_assemblyVersion; + public override string AssemblyVersion => HiveServer2Connection.s_assemblyVersion; private void UpdatePollTimeIfValid(string key, string value) => PollTimeMilliseconds = !string.IsNullOrEmpty(key) && int.TryParse(value, result: out int pollTimeMilliseconds) && pollTimeMilliseconds >= 0 ? pollTimeMilliseconds diff --git a/csharp/src/Drivers/Apache/Impala/ImpalaHttpConnection.cs b/csharp/src/Drivers/Apache/Impala/ImpalaHttpConnection.cs index 4fa6950d9a..53945572d0 100644 --- a/csharp/src/Drivers/Apache/Impala/ImpalaHttpConnection.cs +++ b/csharp/src/Drivers/Apache/Impala/ImpalaHttpConnection.cs @@ -37,8 +37,6 @@ namespace Apache.Arrow.Adbc.Drivers.Apache.Impala internal class ImpalaHttpConnection : ImpalaConnection { private const string BasicAuthenticationScheme = "Basic"; - private static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(ImpalaHttpConnection)); - private static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(ImpalaHttpConnection)); private readonly HiveServer2ProxyConfigurator _proxyConfigurator; diff --git a/csharp/src/Drivers/Apache/Impala/ImpalaStandardConnection.cs b/csharp/src/Drivers/Apache/Impala/ImpalaStandardConnection.cs index c828f82698..6cbef924a8 100644 --- a/csharp/src/Drivers/Apache/Impala/ImpalaStandardConnection.cs +++ b/csharp/src/Drivers/Apache/Impala/ImpalaStandardConnection.cs @@ -32,9 +32,6 @@ namespace Apache.Arrow.Adbc.Drivers.Apache.Impala { internal class ImpalaStandardConnection : ImpalaConnection { - private static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(ImpalaStandardConnection)); - private static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(ImpalaStandardConnection)); - public ImpalaStandardConnection(IReadOnlyDictionary properties) : base(properties) { } diff --git a/csharp/src/Drivers/Apache/Impala/ImpalaStatement.cs b/csharp/src/Drivers/Apache/Impala/ImpalaStatement.cs index 8db1e57b2c..573a08171a 100644 --- a/csharp/src/Drivers/Apache/Impala/ImpalaStatement.cs +++ b/csharp/src/Drivers/Apache/Impala/ImpalaStatement.cs @@ -21,9 +21,6 @@ namespace Apache.Arrow.Adbc.Drivers.Apache.Impala { internal class ImpalaStatement : HiveServer2Statement { - private static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(ImpalaStatement)); - private static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(ImpalaStatement)); - internal ImpalaStatement(ImpalaConnection connection) : base(connection) { @@ -37,8 +34,8 @@ public sealed class Options : ApacheParameters // options specific to Impala go here } - public override string AssemblyName => s_assemblyName; + public override string AssemblyName => HiveServer2Connection.s_assemblyName; - public override string AssemblyVersion => s_assemblyVersion; + public override string AssemblyVersion => HiveServer2Connection.s_assemblyVersion; } } diff --git a/csharp/src/Drivers/Apache/Spark/SparkHttpConnection.cs b/csharp/src/Drivers/Apache/Spark/SparkHttpConnection.cs index 08cb900b7d..aead49343e 100644 --- a/csharp/src/Drivers/Apache/Spark/SparkHttpConnection.cs +++ b/csharp/src/Drivers/Apache/Spark/SparkHttpConnection.cs @@ -38,8 +38,6 @@ internal class SparkHttpConnection : SparkConnection { private const string BasicAuthenticationScheme = "Basic"; private const string BearerAuthenticationScheme = "Bearer"; - private static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(SparkHttpConnection)); - private static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(SparkHttpConnection)); protected readonly HiveServer2ProxyConfigurator _proxyConfigurator; diff --git a/csharp/src/Drivers/Apache/Spark/SparkStandardConnection.cs b/csharp/src/Drivers/Apache/Spark/SparkStandardConnection.cs index 2cea86f488..25d808574f 100644 --- a/csharp/src/Drivers/Apache/Spark/SparkStandardConnection.cs +++ b/csharp/src/Drivers/Apache/Spark/SparkStandardConnection.cs @@ -29,9 +29,6 @@ namespace Apache.Arrow.Adbc.Drivers.Apache.Spark { internal class SparkStandardConnection : SparkHttpConnection { - private static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(SparkStandardConnection)); - private static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(SparkStandardConnection)); - public SparkStandardConnection(IReadOnlyDictionary properties) : base(properties) { } diff --git a/csharp/src/Drivers/Apache/Spark/SparkStatement.cs b/csharp/src/Drivers/Apache/Spark/SparkStatement.cs index 0b7a852adc..6a43134b78 100644 --- a/csharp/src/Drivers/Apache/Spark/SparkStatement.cs +++ b/csharp/src/Drivers/Apache/Spark/SparkStatement.cs @@ -22,9 +22,6 @@ namespace Apache.Arrow.Adbc.Drivers.Apache.Spark { internal class SparkStatement : HiveServer2Statement { - private static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(SparkStatement)); - private static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(SparkStatement)); - internal SparkStatement(SparkConnection connection) : base(connection) { @@ -56,8 +53,8 @@ protected override void SetStatementProperties(TExecuteStatementReq statement) }; } - public override string AssemblyName => s_assemblyName; + public override string AssemblyName => HiveServer2Connection.s_assemblyName; - public override string AssemblyVersion => s_assemblyVersion; + public override string AssemblyVersion => HiveServer2Connection.s_assemblyVersion; } } diff --git a/csharp/src/Drivers/Databricks/BaseDatabricksReader.cs b/csharp/src/Drivers/Databricks/BaseDatabricksReader.cs index b56a1f81d4..ed47424e8a 100644 --- a/csharp/src/Drivers/Databricks/BaseDatabricksReader.cs +++ b/csharp/src/Drivers/Databricks/BaseDatabricksReader.cs @@ -16,11 +16,8 @@ */ using System; -using System.Threading; -using System.Threading.Tasks; -using Apache.Arrow; +using Apache.Arrow.Adbc.Drivers.Apache; using Apache.Arrow.Adbc.Tracing; -using Apache.Arrow.Ipc; namespace Apache.Arrow.Adbc.Drivers.Databricks { @@ -93,5 +90,9 @@ protected void ThrowIfDisposed() throw new ObjectDisposedException(GetType().Name); } } + + public override string AssemblyName => DatabricksConnection.s_assemblyName; + + public override string AssemblyVersion => DatabricksConnection.s_assemblyVersion; } } diff --git a/csharp/src/Drivers/Databricks/CloudFetch/CloudFetchReader.cs b/csharp/src/Drivers/Databricks/CloudFetch/CloudFetchReader.cs index 397d249ccf..e2f0a5f353 100644 --- a/csharp/src/Drivers/Databricks/CloudFetch/CloudFetchReader.cs +++ b/csharp/src/Drivers/Databricks/CloudFetch/CloudFetchReader.cs @@ -20,7 +20,6 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; -using Apache.Arrow.Adbc.Drivers.Apache; using Apache.Arrow.Adbc.Tracing; using Apache.Arrow.Ipc; using Apache.Hive.Service.Rpc.Thrift; @@ -33,9 +32,6 @@ namespace Apache.Arrow.Adbc.Drivers.Databricks.CloudFetch /// internal sealed class CloudFetchReader : BaseDatabricksReader { - private static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(CloudFetchReader)); - private static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(CloudFetchReader)); - private ICloudFetchDownloadManager? downloadManager; private ArrowStreamReader? currentReader; private IDownloadResult? currentDownloadResult; @@ -80,10 +76,6 @@ public CloudFetchReader(DatabricksStatement statement, Schema schema, TFetchResu } } - public override string AssemblyName => s_assemblyName; - - public override string AssemblyVersion => s_assemblyVersion; - /// /// Reads the next record batch from the result set. /// diff --git a/csharp/src/Drivers/Databricks/DatabricksCompositeReader.cs b/csharp/src/Drivers/Databricks/DatabricksCompositeReader.cs index 495aedeea0..0564ac9a8f 100644 --- a/csharp/src/Drivers/Databricks/DatabricksCompositeReader.cs +++ b/csharp/src/Drivers/Databricks/DatabricksCompositeReader.cs @@ -37,12 +37,9 @@ namespace Apache.Arrow.Adbc.Drivers.Databricks /// internal sealed class DatabricksCompositeReader : TracingReader { - private static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(DatabricksCompositeReader)); - private static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(DatabricksCompositeReader)); + public override string AssemblyName => DatabricksConnection.s_assemblyName; - public override string AssemblyName => s_assemblyName; - - public override string AssemblyVersion => s_assemblyVersion; + public override string AssemblyVersion => DatabricksConnection.s_assemblyVersion; public override Schema Schema { get { return _schema; } } diff --git a/csharp/src/Drivers/Databricks/DatabricksConnection.cs b/csharp/src/Drivers/Databricks/DatabricksConnection.cs index a30fc5affd..a280999390 100644 --- a/csharp/src/Drivers/Databricks/DatabricksConnection.cs +++ b/csharp/src/Drivers/Databricks/DatabricksConnection.cs @@ -28,8 +28,6 @@ using Apache.Arrow.Adbc.Drivers.Apache.Hive2.Client; using Apache.Arrow.Adbc.Drivers.Apache.Spark; using Apache.Arrow.Adbc.Drivers.Databricks.Auth; -using Apache.Arrow.Adbc.Drivers.Databricks.CloudFetch; -using Apache.Arrow.Adbc.Tracing; using Apache.Arrow.Ipc; using Apache.Hive.Service.Rpc.Thrift; using Thrift.Protocol; @@ -38,6 +36,9 @@ namespace Apache.Arrow.Adbc.Drivers.Databricks { internal class DatabricksConnection : SparkHttpConnection { + internal static new readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(DatabricksConnection)); + internal static new readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(DatabricksConnection)); + private bool _applySSPWithQueries = false; private bool _enableDirectResults = true; private bool _enableMultipleCatalogSupport = true; @@ -648,6 +649,10 @@ protected override void ValidateOAuthParameters() } } + public override string AssemblyName => s_assemblyName; + + public override string AssemblyVersion => s_assemblyVersion; + internal static string? HandleSparkCatalog(string? CatalogName) { if (CatalogName != null && CatalogName.Equals("SPARK", StringComparison.OrdinalIgnoreCase)) diff --git a/csharp/src/Drivers/Databricks/DatabricksReader.cs b/csharp/src/Drivers/Databricks/DatabricksReader.cs index 13ca37e7d4..cab99b800b 100644 --- a/csharp/src/Drivers/Databricks/DatabricksReader.cs +++ b/csharp/src/Drivers/Databricks/DatabricksReader.cs @@ -28,9 +28,6 @@ namespace Apache.Arrow.Adbc.Drivers.Databricks { internal sealed class DatabricksReader : BaseDatabricksReader { - private static readonly string s_assemblyName = ApacheUtility.GetAssemblyName(typeof(DatabricksReader)); - private static readonly string s_assemblyVersion = ApacheUtility.GetAssemblyVersion(typeof(DatabricksReader)); - List? batches; int index; IArrowReader? reader; @@ -50,10 +47,6 @@ public DatabricksReader(DatabricksStatement statement, Schema schema, TFetchResu } } - public override string AssemblyName => s_assemblyName; - - public override string AssemblyVersion => s_assemblyVersion; - public override async ValueTask ReadNextRecordBatchAsync(CancellationToken cancellationToken = default) { return await this.TraceActivity(async activity => diff --git a/csharp/src/Drivers/Databricks/DatabricksStatement.cs b/csharp/src/Drivers/Databricks/DatabricksStatement.cs index f8dde3e782..31e529ed33 100644 --- a/csharp/src/Drivers/Databricks/DatabricksStatement.cs +++ b/csharp/src/Drivers/Databricks/DatabricksStatement.cs @@ -21,6 +21,7 @@ using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Apache.Arrow.Adbc.Drivers.Apache; using Apache.Arrow.Adbc.Drivers.Apache.Hive2; using Apache.Arrow.Adbc.Drivers.Apache.Spark; using Apache.Arrow.Adbc.Drivers.Databricks.CloudFetch; @@ -567,6 +568,10 @@ protected override async Task GetColumnsExtendedAsync(CancellationT return CreateExtendedColumnsResult(columnMetadataSchema,result); } + public override string AssemblyName => DatabricksConnection.s_assemblyName; + + public override string AssemblyVersion => DatabricksConnection.s_assemblyVersion; + /// /// Creates the schema for the column metadata result set. /// This schema is used for the GetColumns metadata query.