diff --git a/csharp/src/Apache.Arrow.Adbc/Apache.Arrow.Adbc.csproj b/csharp/src/Apache.Arrow.Adbc/Apache.Arrow.Adbc.csproj
index 8800081f8c..345ab3cbf3 100644
--- a/csharp/src/Apache.Arrow.Adbc/Apache.Arrow.Adbc.csproj
+++ b/csharp/src/Apache.Arrow.Adbc/Apache.Arrow.Adbc.csproj
@@ -7,7 +7,6 @@
-
diff --git a/csharp/src/Drivers/Apache/Apache.Arrow.Adbc.Drivers.Apache.csproj b/csharp/src/Drivers/Apache/Apache.Arrow.Adbc.Drivers.Apache.csproj
index 13efc4e0ba..28d6929b69 100644
--- a/csharp/src/Drivers/Apache/Apache.Arrow.Adbc.Drivers.Apache.csproj
+++ b/csharp/src/Drivers/Apache/Apache.Arrow.Adbc.Drivers.Apache.csproj
@@ -6,7 +6,6 @@
-
diff --git a/csharp/src/Drivers/FlightSql/Apache.Arrow.Adbc.Drivers.FlightSql.csproj b/csharp/src/Drivers/FlightSql/Apache.Arrow.Adbc.Drivers.FlightSql.csproj
index 6a311fd930..ec718b6376 100644
--- a/csharp/src/Drivers/FlightSql/Apache.Arrow.Adbc.Drivers.FlightSql.csproj
+++ b/csharp/src/Drivers/FlightSql/Apache.Arrow.Adbc.Drivers.FlightSql.csproj
@@ -4,7 +4,7 @@
-
+
diff --git a/csharp/test/Apache.Arrow.Adbc.Tests/ClientTests.cs b/csharp/test/Apache.Arrow.Adbc.Tests/ClientTests.cs
index 0862f86d4d..3deac62831 100644
--- a/csharp/test/Apache.Arrow.Adbc.Tests/ClientTests.cs
+++ b/csharp/test/Apache.Arrow.Adbc.Tests/ClientTests.cs
@@ -44,7 +44,7 @@ public static void CanClientExecuteUpdate(
Adbc.Client.AdbcConnection adbcConnection,
TestConfiguration testConfiguration,
string[] queries,
- List expectedResults,
+ IReadOnlyList expectedResults,
string? environmentName = null)
{
if (adbcConnection == null) throw new ArgumentNullException(nameof(adbcConnection));
diff --git a/csharp/test/Apache.Arrow.Adbc.Tests/TestBase.cs b/csharp/test/Apache.Arrow.Adbc.Tests/TestBase.cs
index 46f52584a8..8bbd2df116 100644
--- a/csharp/test/Apache.Arrow.Adbc.Tests/TestBase.cs
+++ b/csharp/test/Apache.Arrow.Adbc.Tests/TestBase.cs
@@ -376,6 +376,16 @@ protected async Task SelectAndValidateValuesAsync(string selectStatement, object
await SelectAndValidateValuesAsync(selectStatement, [value], expectedLength);
}
+ private static T? ArrowArrayAs(IArrowArray arrowArray)
+ where T : IArrowArray
+ {
+ if (arrowArray is T t)
+ {
+ return t;
+ }
+ return default;
+ }
+
///
/// Selects a single value and validates it equality with expected value and number of results.
///
@@ -391,8 +401,23 @@ protected async Task SelectAndValidateValuesAsync(string selectStatement, object
int actualLength = 0;
using (IArrowArrayStream stream = queryResult.Stream ?? throw new InvalidOperationException("stream is null"))
{
+ Dictionary> valueGetters = new()
+ {
+ { ArrowTypeId.Decimal128, (a, i) => ArrowArrayAs(a)?.GetSqlDecimal(i) },
+ { ArrowTypeId.Double, (a, i) => ArrowArrayAs(a)?.GetValue(i) },
+ { ArrowTypeId.Float, (a, i) => ArrowArrayAs(a)?.GetValue(i) },
+ { ArrowTypeId.Int64, (a, i) => ArrowArrayAs(a)?.GetValue(i) },
+ { ArrowTypeId.Int32, (a, i) => ArrowArrayAs(a)?.GetValue(i) },
+ { ArrowTypeId.Int16, (a, i) => ArrowArrayAs(a)?.GetValue(i) },
+ { ArrowTypeId.Int8, (a, i) => ArrowArrayAs(a)?.GetValue(i) },
+ { ArrowTypeId.String, (a, i) => ArrowArrayAs(a)?.GetString(i) },
+ { ArrowTypeId.Timestamp, (a, i) => ArrowArrayAs(a)?.GetTimestamp(i) },
+ { ArrowTypeId.Date32, (a, i) => ArrowArrayAs(a)?.GetDateTimeOffset(i) },
+ { ArrowTypeId.Boolean, (a, i) => ArrowArrayAs(a)?.GetValue(i) },
+ };
// Assume first column
Field field = stream.Schema.GetFieldByIndex(0);
+ Int32Array? indexArray = null;
while (true)
{
using (RecordBatch nextBatch = await stream.ReadNextRecordBatchAsync())
@@ -400,62 +425,6 @@ protected async Task SelectAndValidateValuesAsync(string selectStatement, object
if (nextBatch == null) { break; }
switch (field.DataType)
{
- case Decimal128Type:
- Decimal128Array decimalArray = (Decimal128Array)nextBatch.Column(0);
- actualLength += decimalArray.Length;
- ValidateValue((i) => values?[i], decimalArray.Length, (i) => decimalArray.GetSqlDecimal(i));
- break;
- case DoubleType:
- DoubleArray doubleArray = (DoubleArray)nextBatch.Column(0);
- actualLength += doubleArray.Length;
- ValidateValue((i) => values?[i], doubleArray.Length, (i) => doubleArray.GetValue(i));
- break;
- case FloatType:
- FloatArray floatArray = (FloatArray)nextBatch.Column(0);
- actualLength += floatArray.Length;
- ValidateValue((i) => values?[i], floatArray.Length, (i) => floatArray.GetValue(i));
- break;
- case Int64Type:
- Int64Array int64Array = (Int64Array)nextBatch.Column(0);
- actualLength += int64Array.Length;
- ValidateValue((i) => values?[i], int64Array.Length, (i) => int64Array.GetValue(i));
- break;
- case Int32Type:
- Int32Array intArray = (Int32Array)nextBatch.Column(0);
- actualLength += intArray.Length;
- ValidateValue((i) => values?[i], intArray.Length, (i) => intArray.GetValue(i));
- break;
- case Int16Type:
- Int16Array shortArray = (Int16Array)nextBatch.Column(0);
- actualLength += shortArray.Length;
- ValidateValue((i) => values?[i], shortArray.Length, (i) => shortArray.GetValue(i));
- break;
- case Int8Type:
- Int8Array tinyIntArray = (Int8Array)nextBatch.Column(0);
- actualLength += tinyIntArray.Length;
- ValidateValue((i) => values?[i], tinyIntArray.Length, (i) => tinyIntArray.GetValue(i));
- break;
- case StringType:
- StringArray stringArray = (StringArray)nextBatch.Column(0);
- actualLength += stringArray.Length;
- ValidateValue((i) => values?[i], stringArray.Length, (i) => stringArray.GetString(i));
- break;
- case TimestampType:
- TimestampArray timestampArray = (TimestampArray)nextBatch.Column(0);
- actualLength += timestampArray.Length;
- ValidateValue((i) => values?[i], timestampArray.Length, (i) => timestampArray.GetTimestamp(i));
- break;
- case Date32Type:
- Date32Array date32Array = (Date32Array)nextBatch.Column(0);
- actualLength += date32Array.Length;
- ValidateValue((i) => values?[i], date32Array.Length, (i) => date32Array.GetDateTimeOffset(i));
- break;
- case BooleanType:
- BooleanArray booleanArray = (BooleanArray)nextBatch.Column(0);
- Int32Array? indexArray = hasIndexColumn ? (Int32Array)nextBatch.Column(1) : null;
- actualLength += booleanArray.Length;
- ValidateValue((i) => values?[i], booleanArray.Length, (i) => booleanArray.GetValue(i), indexArray);
- break;
case BinaryType:
BinaryArray binaryArray = (BinaryArray)nextBatch.Column(0);
actualLength += binaryArray.Length;
@@ -464,10 +433,20 @@ protected async Task SelectAndValidateValuesAsync(string selectStatement, object
case NullType:
NullArray nullArray = (NullArray)nextBatch.Column(0);
actualLength += nullArray.Length;
- ValidateValue((i) => values?[i] == null, nullArray.Length, (i) => nullArray.IsNull(i));
+ ValidateValue(nullArray.Length, (i) => values?[i] == null, (i) => nullArray.IsNull(i));
break;
default:
- Assert.Fail($"Unhandled datatype {field.DataType}");
+ if (valueGetters.TryGetValue(field.DataType.TypeId, out Func? valueGetter))
+ {
+ IArrowArray array = nextBatch.Column(0);
+ actualLength += array.Length;
+ indexArray = hasIndexColumn ? (Int32Array)nextBatch.Column(1) : null;
+ ValidateValue(array.Length, (i) => values?[i], (i) => valueGetter(array, i), indexArray, array.IsNull);
+ }
+ else
+ {
+ Assert.Fail($"Unhandled datatype {field.DataType}");
+ }
break;
}
@@ -497,15 +476,20 @@ private static void ValidateBinaryArrayValue(Func expectedValues,
///
/// Validates a single values for all results (in the batch).
///
- /// The value to validate.
/// The length of the current batch/array.
+ /// The value to validate.
/// The getter function to retrieve the actual value.
- private static void ValidateValue(Func value, int length, Func getter, Int32Array? indexColumn = null)
+ ///
+ private static void ValidateValue(int length, Func value, Func getter, Int32Array? indexColumn = null, Func? isNullEvaluator = default)
{
for (int i = 0; i < length; i++)
{
int valueIndex = indexColumn?.GetValue(i) ?? i;
object? expected = value(valueIndex);
+ if (isNullEvaluator != null)
+ {
+ Assert.Equal(expected == null, isNullEvaluator(i));
+ }
object? actual = getter(i);
Assert.Equal
diff --git a/csharp/test/Drivers/Apache/ApacheTestConfiguration.cs b/csharp/test/Drivers/Apache/ApacheTestConfiguration.cs
index 7d12292030..fb62ccd9a7 100644
--- a/csharp/test/Drivers/Apache/ApacheTestConfiguration.cs
+++ b/csharp/test/Drivers/Apache/ApacheTestConfiguration.cs
@@ -27,9 +27,6 @@ public class ApacheTestConfiguration : TestConfiguration
[JsonPropertyName("port")]
public string Port { get; set; } = string.Empty;
- [JsonPropertyName("token"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
- public string Token { get; set; } = string.Empty;
-
[JsonPropertyName("path"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string Path { get; set; } = string.Empty;
@@ -54,5 +51,13 @@ public class ApacheTestConfiguration : TestConfiguration
[JsonPropertyName("http_request_timeout_ms"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string HttpRequestTimeoutMilliseconds { get; set; } = string.Empty;
+ [JsonPropertyName("type"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
+ public string Type { get; set; } = string.Empty;
+
+ [JsonPropertyName("data_type_conv"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
+ public string DataTypeConversion { get; set; } = string.Empty;
+
+ [JsonPropertyName("tls_options"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
+ public string TlsOptions { get; set; } = string.Empty;
}
}
diff --git a/csharp/test/Drivers/Apache/Common/BinaryBooleanValueTests.cs b/csharp/test/Drivers/Apache/Common/BinaryBooleanValueTests.cs
new file mode 100644
index 0000000000..fb6d355443
--- /dev/null
+++ b/csharp/test/Drivers/Apache/Common/BinaryBooleanValueTests.cs
@@ -0,0 +1,154 @@
+/*
+* 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.Threading.Tasks;
+using Apache.Arrow.Adbc.Tests.Drivers.Apache.Hive2;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace Apache.Arrow.Adbc.Tests.Drivers.Apache.Common
+{
+ // TODO: When supported, use prepared statements instead of SQL string literals
+ // Which will better test how the driver handles values sent/received
+
+ ///
+ /// Validates that specific binary and boolean values can be inserted, retrieved and targeted correctly
+ ///
+ public abstract class BinaryBooleanValueTests : TestBase
+ where TConfig : TestConfiguration
+ where TEnv : HiveServer2TestEnvironment
+ {
+ public BinaryBooleanValueTests(ITestOutputHelper output, TestEnvironment.Factory testEnvFactory)
+ : base(output, testEnvFactory) { }
+
+ public static IEnumerable
diff --git a/csharp/test/Drivers/FlightSql/Apache.Arrow.Adbc.Tests.Drivers.FlightSql.csproj b/csharp/test/Drivers/FlightSql/Apache.Arrow.Adbc.Tests.Drivers.FlightSql.csproj
index 1b20a2157f..265b67827a 100644
--- a/csharp/test/Drivers/FlightSql/Apache.Arrow.Adbc.Tests.Drivers.FlightSql.csproj
+++ b/csharp/test/Drivers/FlightSql/Apache.Arrow.Adbc.Tests.Drivers.FlightSql.csproj
@@ -11,7 +11,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/csharp/test/Drivers/Interop/Snowflake/Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake.csproj b/csharp/test/Drivers/Interop/Snowflake/Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake.csproj
index f657ed09d1..f660e7a645 100644
--- a/csharp/test/Drivers/Interop/Snowflake/Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake.csproj
+++ b/csharp/test/Drivers/Interop/Snowflake/Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake.csproj
@@ -22,7 +22,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/java/pom.xml b/java/pom.xml
index 7c2a314feb..66cc7b43fe 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -97,7 +97,7 @@
18.0.0
- 3.48.2
+ 3.48.3
11
11