This is an automated email from the ASF dual-hosted git repository.

curth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new cd60c0eca feat(csharp/src/Apache.Arrow.Adbc): Remove 
AdbcConnection.GetInfo(List<int>) (#1760)
cd60c0eca is described below

commit cd60c0eca5872e3c7df490c18710e0255d6e98e0
Author: Curt Hagenlocher <[email protected]>
AuthorDate: Wed Apr 24 15:51:22 2024 -0700

    feat(csharp/src/Apache.Arrow.Adbc): Remove 
AdbcConnection.GetInfo(List<int>) (#1760)
    
    Closes #1759
---
 csharp/src/Apache.Arrow.Adbc/AdbcConnection.cs     | 20 ++-----------------
 .../src/Apache.Arrow.Adbc/C/CAdbcDriverExporter.cs |  4 ++--
 .../src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs | 23 +++++++++-------------
 .../Drivers/Apache/Hive2/HiveServer2Connection.cs  |  5 -----
 .../src/Drivers/Apache/Impala/ImpalaConnection.cs  |  5 -----
 csharp/src/Drivers/Apache/Spark/SparkConnection.cs |  2 --
 6 files changed, 13 insertions(+), 46 deletions(-)

diff --git a/csharp/src/Apache.Arrow.Adbc/AdbcConnection.cs 
b/csharp/src/Apache.Arrow.Adbc/AdbcConnection.cs
index b33dd5c48..442b1d3ee 100644
--- a/csharp/src/Apache.Arrow.Adbc/AdbcConnection.cs
+++ b/csharp/src/Apache.Arrow.Adbc/AdbcConnection.cs
@@ -70,21 +70,7 @@ namespace Apache.Arrow.Adbc
         /// The metadata items to fetch.
         /// </param>
         /// <returns>
-        /// A statement that can be immediately executed.
-        /// </returns>
-        public virtual IArrowArrayStream GetInfo(List<int> codes)
-        {
-            throw AdbcException.NotImplemented("Connection does not support 
GetInfo");
-        }
-
-        /// <summary>
-        /// Get metadata about the driver/database.
-        /// </summary>
-        /// <param name="codes">
-        /// The metadata items to fetch.
-        /// </param>
-        /// <returns>
-        /// A statement that can be immediately executed.
+        /// Metadata about the driver and/or database
         /// </returns>
         /// <exception cref="ArgumentNullException"></exception>
         public virtual IArrowArrayStream GetInfo(List<AdbcInfoCode> codes)
@@ -92,9 +78,7 @@ namespace Apache.Arrow.Adbc
             if (codes == null)
                 throw new ArgumentNullException(nameof(codes));
 
-            List<int> codeValues = codes.Select(x => (int)x).ToList();
-
-            return GetInfo(codeValues);
+            throw AdbcException.NotImplemented("Connection does not support 
GetInfo");
         }
 
         /// <summary>
diff --git a/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverExporter.cs 
b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverExporter.cs
index a8b3089b3..9be44b3ea 100644
--- a/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverExporter.cs
+++ b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverExporter.cs
@@ -847,8 +847,8 @@ namespace Apache.Arrow.Adbc.C
 
             public unsafe void GetInfo(int* info_codes, int info_codes_length, 
CArrowArrayStream* stream)
             {
-                int[] infoCodes = new int[info_codes_length];
-                fixed (int* infoCodesPtr = infoCodes)
+                AdbcInfoCode[] infoCodes = new AdbcInfoCode[info_codes_length];
+                fixed (AdbcInfoCode* infoCodesPtr = infoCodes)
                 {
                     long length = (long)info_codes_length * sizeof(int);
                     Buffer.MemoryCopy(info_codes, infoCodesPtr, length, 
length);
diff --git a/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs 
b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs
index 82b2a8c15..2d7099b4e 100644
--- a/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs
+++ b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs
@@ -222,12 +222,7 @@ namespace Apache.Arrow.Adbc.C
                 return new AdbcStatementNative(_nativeDriver, nativeStatement);
             }
 
-            public override IArrowArrayStream GetInfo(List<AdbcInfoCode> codes)
-            {
-                return GetInfo(codes.Select(x => (int)x).ToList<int>());
-            }
-
-            public override unsafe IArrowArrayStream GetInfo(List<int> codes)
+            public unsafe override IArrowArrayStream 
GetInfo(List<AdbcInfoCode> codes)
             {
                 CArrowArrayStream* nativeArrayStream = 
CArrowArrayStream.Create();
 
@@ -696,28 +691,28 @@ namespace Apache.Arrow.Adbc.C
             }
 
 #if NET5_0_OR_GREATER
-            public unsafe void Call(delegate* unmanaged<CAdbcConnection*, 
int*, int, CArrowArrayStream*, CAdbcError*, AdbcStatusCode> fn, ref 
CAdbcConnection connection, List<int> infoCodes, CArrowArrayStream* stream)
+            public unsafe void Call(delegate* unmanaged<CAdbcConnection*, 
int*, int, CArrowArrayStream*, CAdbcError*, AdbcStatusCode> fn, ref 
CAdbcConnection connection, List<AdbcInfoCode> infoCodes, CArrowArrayStream* 
stream)
             {
                 fixed (CAdbcConnection* cn = &connection)
                 fixed (CAdbcError* e = &_error)
                 {
-                    Span<int> span = CollectionsMarshal.AsSpan(infoCodes);
-                    fixed (int* spanPtr = span)
+                    Span<AdbcInfoCode> span = 
CollectionsMarshal.AsSpan(infoCodes);
+                    fixed (AdbcInfoCode* spanPtr = span)
                     {
-                        TranslateCode(fn(cn, spanPtr, infoCodes.Count, stream, 
e));
+                        TranslateCode(fn(cn, (int*)spanPtr, infoCodes.Count, 
stream, e));
                     }
                 }
             }
 #else
-            public unsafe void Call(IntPtr ptr, ref CAdbcConnection 
connection, List<int> infoCodes, CArrowArrayStream* stream)
+            public unsafe void Call(IntPtr ptr, ref CAdbcConnection 
connection, List<AdbcInfoCode> infoCodes, CArrowArrayStream* stream)
             {
                 fixed (CAdbcConnection* cn = &connection)
                 fixed (CAdbcError* e = &_error)
                 {
-                    Span<int> span = infoCodes.ToArray().AsSpan();
-                    fixed (int* spanPtr = span)
+                    Span<AdbcInfoCode> span = infoCodes.ToArray().AsSpan();
+                    fixed (AdbcInfoCode* spanPtr = span)
                     {
-                        
TranslateCode(Marshal.GetDelegateForFunctionPointer<CAdbcDriverExporter.ConnectionGetInfo>(ptr)(cn,
 spanPtr, infoCodes.Count, stream, e));
+                        
TranslateCode(Marshal.GetDelegateForFunctionPointer<CAdbcDriverExporter.ConnectionGetInfo>(ptr)(cn,
 (int*)spanPtr, infoCodes.Count, stream, e));
                     }
                 }
             }
diff --git a/csharp/src/Drivers/Apache/Hive2/HiveServer2Connection.cs 
b/csharp/src/Drivers/Apache/Hive2/HiveServer2Connection.cs
index ae0c47a93..868d7d65c 100644
--- a/csharp/src/Drivers/Apache/Hive2/HiveServer2Connection.cs
+++ b/csharp/src/Drivers/Apache/Hive2/HiveServer2Connection.cs
@@ -64,11 +64,6 @@ namespace Apache.Arrow.Adbc.Drivers.Apache.Hive2
             throw new NotImplementedException();
         }
 
-        public override IArrowArrayStream GetInfo(List<int> codes)
-        {
-            throw new NotImplementedException();
-        }
-
         public override IArrowArrayStream GetTableTypes()
         {
             throw new NotImplementedException();
diff --git a/csharp/src/Drivers/Apache/Impala/ImpalaConnection.cs 
b/csharp/src/Drivers/Apache/Impala/ImpalaConnection.cs
index ec6210c2f..d08488df5 100644
--- a/csharp/src/Drivers/Apache/Impala/ImpalaConnection.cs
+++ b/csharp/src/Drivers/Apache/Impala/ImpalaConnection.cs
@@ -60,11 +60,6 @@ namespace Apache.Arrow.Adbc.Drivers.Apache.Impala
             return new ImpalaStatement(this);
         }
 
-        public override IArrowArrayStream GetInfo(List<int> codes)
-        {
-            throw new System.NotImplementedException();
-        }
-
         public override IArrowArrayStream GetObjects(GetObjectsDepth depth, 
string catalogPattern, string dbSchemaPattern, string tableNamePattern, 
List<string> tableTypes, string columnNamePattern)
         {
             throw new System.NotImplementedException();
diff --git a/csharp/src/Drivers/Apache/Spark/SparkConnection.cs 
b/csharp/src/Drivers/Apache/Spark/SparkConnection.cs
index fa1ae62da..17c369d20 100644
--- a/csharp/src/Drivers/Apache/Spark/SparkConnection.cs
+++ b/csharp/src/Drivers/Apache/Spark/SparkConnection.cs
@@ -272,8 +272,6 @@ namespace Apache.Arrow.Adbc.Drivers.Apache.Spark
 
         }
 
-        public override IArrowArrayStream GetInfo(List<int> codes) => 
base.GetInfo(codes);
-
         public override IArrowArrayStream GetTableTypes()
         {
             StringArray.Builder tableTypesBuilder = new StringArray.Builder();

Reply via email to