Skip to content

Commit dc96929

Browse files
author
David Coe
committed
add Time64 test
1 parent 6390185 commit dc96929

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

csharp/test/Apache.Arrow.Adbc.Tests/IArrowArrayExtensionsTests.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,28 @@ public void ValidateTime32()
5454
}
5555

5656
[Fact]
57-
public void ValidateTime64() { }
57+
public void ValidateTime64()
58+
{
59+
TimeSpan t = TimeSpan.FromMinutes(5);
60+
long microseconds = Convert.ToInt64(t.TotalMinutes * 60 * 1_000_000);
61+
Time64Array.Builder secondBuilder = new Time64Array.Builder(Types.TimeUnit.Microsecond);
62+
secondBuilder.Append(microseconds);
63+
Time64Array t64microseconds = secondBuilder.Build();
64+
65+
Assert.Equal(microseconds, t64microseconds.GetValue(0));
66+
Assert.Equal(microseconds, t64microseconds.GetMicroSeconds(0));
67+
Assert.Equal(t, t64microseconds.ValueAt(0));
68+
Assert.Equal(t, t64microseconds.Data.DataType.GetValueConverter().Invoke(t64microseconds, 0));
5869

70+
long nanoseconds = Convert.ToInt64(t.TotalMinutes * 60 * 1_000_000_000);
71+
Time64Array.Builder msbuilder = new Time64Array.Builder(Types.TimeUnit.Nanosecond);
72+
msbuilder.Append(nanoseconds);
73+
Time64Array t64ns = msbuilder.Build();
74+
75+
Assert.Equal(nanoseconds, t64ns.GetValue(0));
76+
Assert.Equal(nanoseconds, t64ns.GetNanoSeconds(0));
77+
Assert.Equal(t, t64ns.ValueAt(0));
78+
Assert.Equal(t, t64ns.Data.DataType.GetValueConverter().Invoke(t64ns, 0));
79+
}
5980
}
6081
}

csharp/test/Drivers/BigQuery/BigQueryTestingUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ BigQueryTestEnvironment testEnvironment
5151
/// <returns></returns>
5252
internal static Dictionary<string, string> GetBigQueryParameters(BigQueryTestEnvironment testEnvironment)
5353
{
54-
Dictionary<string, string> parameters = new Dictionary<string, string>{};
54+
Dictionary<string, string> parameters = new Dictionary<string, string>();
5555

5656
if (!string.IsNullOrEmpty(testEnvironment.ProjectId))
5757
{

0 commit comments

Comments
 (0)