CurtHagenlocher commented on code in PR #1849:
URL: https://github.com/apache/arrow-adbc/pull/1849#discussion_r1598772178


##########
csharp/test/Drivers/Apache/Spark/StatementTests.cs:
##########
@@ -0,0 +1,108 @@
+/*
+* 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.Threading.Tasks;
+using Apache.Arrow.Adbc.Drivers.Apache.Hive2;
+using Apache.Arrow.Adbc.Tests.Xunit;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace Apache.Arrow.Adbc.Tests.Drivers.Apache.Spark
+{
+    /// <summary>
+    /// Class for testing the Snowflake ADBC driver connection tests.
+    /// </summary>
+    /// <remarks>
+    /// Tests are ordered to ensure data is created for the other
+    /// queries to run.
+    /// </remarks>
+    [TestCaseOrderer("Apache.Arrow.Adbc.Tests.Xunit.TestOrderer", 
"Apache.Arrow.Adbc.Tests")]
+    public class StatementTests : SparkTestBase
+    {
+        private static List<string> DefaultTableTypes => new() { "BASE TABLE", 
"VIEW" };
+
+        public StatementTests(ITestOutputHelper? outputHelper) : 
base(outputHelper)
+        {
+            Skip.IfNot(Utils.CanExecuteTestConfig(TestConfigVariable));
+        }
+
+        /// <summary>
+        /// Validates if the SetOption handle valid/invalid data correctly for 
the PollTime option.
+        /// </summary>
+        [SkippableTheory]
+        [InlineData(null, true)]
+        [InlineData("-1", true)]
+        [InlineData("zero", true)]
+        [InlineData("-2147483648", true)]
+        [InlineData("2147483648", true)]
+        [InlineData("0")]
+        [InlineData("1")]
+        [InlineData("2147483647")]
+        public void CanSetOptionPollTime(string? value, bool throws = false)
+        {
+            AdbcStatement statement = NewConnection().CreateStatement();
+            if (throws)
+            {
+                Assert.Throws<ArgumentException>(() => 
statement.SetOption(HiveServer2Statement.StatementOptions.PollTimeMilliseconds, 
value));
+            }
+            else
+            {
+                
statement.SetOption(HiveServer2Statement.StatementOptions.PollTimeMilliseconds, 
value);
+            }
+        }
+
+        /// <summary>
+        /// Validates if the SetOption handle valid/invalid data correctly for 
the BatchSize option.
+        /// </summary>
+        [SkippableTheory]
+        [InlineData(null, true)]
+        [InlineData("-1", true)]
+        [InlineData("one", true)]
+        [InlineData("-2147483648", true)]
+        [InlineData("2147483648", true)]
+        [InlineData("0", true)]
+        [InlineData("1")]
+        [InlineData("2147483647")]
+        public void CanSetOptionBatchSize(string? value, bool throws = false)

Review Comment:
   There are a lot of new nullability warnings here. To use null as a valid 
test value, we may need to use the "null forgiveness" operator.
   
   I've now checked in a change to convert nullability and other warnings into 
errors to encourage a warnings-free build.



##########
csharp/src/Drivers/Apache/Hive2/HiveServer2Statement.cs:
##########
@@ -123,9 +138,23 @@ protected async ValueTask<Schema> GetSchemaAsync()
             return SchemaParser.GetArrowSchema(response.Schema);
         }
 
-        protected internal int PollTimeMilliseconds { get; } = 
PollTimeMillisecondsDefault;
+        protected internal int PollTimeMilliseconds { get; private set; } = 
PollTimeMillisecondsDefault;
+
+        protected internal int BatchSize { get; private set; } = 
BatchSizeDefault;
+
+        public static class StatementOptions

Review Comment:
   What if we establish a convention of having a static class in appropriate 
places, like
   
   ```
   class HiveServer2Statement : AdbcStatement {
       public static class Options {
           // options common to all HiveServer2-derived drivers go here
           public static string PollTimeMilliseconds = "...";
       }
   }
   
   class SparkStatement : HiveServer2Statement {
       new public static class Options : HiveServer2Statement.Options {
           // options specific to Spark go here
           // ...
       }
   }
   
   ```



-- 
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]

Reply via email to