Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Core to 2.26. #464

Merged
merged 6 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- os: windows-latest
platform: windows-x86_64
- tag: dev
tag: [release-2.25, dev]
tag: [release-2.26, dev]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout TileDB
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
strategy:
fail-fast: false
matrix:
tag: [release-2.25, dev]
tag: [release-2.26, dev]
runs-on: ubuntu-latest
steps:
- name: Checkout TileDB-CSharp
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
tag: [release-2.25, dev]
tag: [release-2.26, dev]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout TileDB-CSharp
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<TileDBNativePackageName>TileDB.Native</TileDBNativePackageName>
<TileDBNativeVersionMajor>2</TileDBNativeVersionMajor>
<TileDBNativeVersionMinor>25</TileDBNativeVersionMinor>
<TileDBNativeVersionMinor>26</TileDBNativeVersionMinor>
<TileDBNativePackageVersion>[$(TileDBNativeVersionMajor).$(TileDBNativeVersionMinor).0,$(TileDBNativeVersionMajor).$([MSBuild]::Add($(TileDBNativeVersionMinor), 1)).0)</TileDBNativePackageVersion>

<!-- The DevelopmentBuild property switches to the locally built native packages.
Expand Down
11 changes: 11 additions & 0 deletions sources/TileDB.CSharp/ArraySchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using FilterListHandle = TileDB.CSharp.Marshalling.SafeHandles.FilterListHandle;
using DomainHandle = TileDB.CSharp.Marshalling.SafeHandles.DomainHandle;
using AttributeHandle = TileDB.CSharp.Marshalling.SafeHandles.AttributeHandle;
using TileDB.CSharp.Marshalling;

namespace TileDB.CSharp;

Expand Down Expand Up @@ -595,4 +596,14 @@ public bool IsVarSize(string name)

return false;
}

/// <inheritdoc/>
public override string ToString()
{
using var ctx = _ctx.Handle.Acquire();
using var handle = _handle.Acquire();
using var strPtr = new StringHandleHolder();
_ctx.handle_error(Methods.tiledb_array_schema_dump_str(ctx, handle, &strPtr._handle));
return strPtr.ToString();
}
}
10 changes: 10 additions & 0 deletions sources/TileDB.CSharp/Attribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,4 +440,14 @@ public static Attribute Create<T>(Context ctx, string name)
var datatype = EnumUtil.TypeToDataType(typeof(T));
return new Attribute(ctx, name, datatype);
}

/// <inheritdoc/>
public override string ToString()
{
using var ctx = _ctx.Handle.Acquire();
using var handle = _handle.Acquire();
using var strPtr = new StringHandleHolder();
_ctx.handle_error(Methods.tiledb_attribute_dump_str(ctx, handle, &strPtr._handle));
return strPtr.ToString();
}
}
10 changes: 10 additions & 0 deletions sources/TileDB.CSharp/Dimension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,14 @@ public static Dimension CreateString(Context ctx, string name)
var str_dim_handle = DimensionHandle.Create(ctx, name, tiledb_datatype_t.TILEDB_STRING_ASCII, null, null);
return new Dimension(ctx, str_dim_handle);
}

/// <inheritdoc/>
public override string ToString()
{
using var ctx = _ctx.Handle.Acquire();
using var handle = _handle.Acquire();
using var strPtr = new StringHandleHolder();
_ctx.handle_error(Methods.tiledb_dimension_dump_str(ctx, handle, &strPtr._handle));
return strPtr.ToString();
}
}
12 changes: 12 additions & 0 deletions sources/TileDB.CSharp/Domain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using TileDB.Interop;
using DomainHandle = TileDB.CSharp.Marshalling.SafeHandles.DomainHandle;
using DimensionHandle = TileDB.CSharp.Marshalling.SafeHandles.DimensionHandle;
using TileDB.CSharp.Marshalling;

namespace TileDB.CSharp;

Expand Down Expand Up @@ -176,5 +177,16 @@ public bool HasDimension(string name)
_ctx.handle_error(Methods.tiledb_domain_has_dimension(ctxHandle, handle, ms_name, &has_dim));
return has_dim > 0;
}


/// <inheritdoc/>
public override string ToString()
{
using var ctx = _ctx.Handle.Acquire();
using var handle = _handle.Acquire();
using var strPtr = new StringHandleHolder();
_ctx.handle_error(Methods.tiledb_domain_dump_str(ctx, handle, &strPtr._handle));
return strPtr.ToString();
}
#endregion
}
10 changes: 10 additions & 0 deletions sources/TileDB.CSharp/Enumeration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,4 +384,14 @@ public ulong[] GetRawOffsets()
_ctx.handle_error(Methods.tiledb_enumeration_get_offsets(ctxHandle, handle, &data, &dataSize));
return new ReadOnlySpan<ulong>(data, checked((int)(dataSize / sizeof(ulong)))).ToArray();
}

/// <inheritdoc/>
public override string ToString()
{
using var ctx = _ctx.Handle.Acquire();
using var handle = _handle.Acquire();
using var strPtr = new StringHandleHolder();
_ctx.handle_error(Methods.tiledb_enumeration_dump_str(ctx, handle, &strPtr._handle));
return strPtr.ToString();
}
}
40 changes: 36 additions & 4 deletions sources/TileDB.CSharp/Interop/Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ public static int tiledb_status([NativeTypeName("capi_return_t")] int x)
[return: NativeTypeName("int32_t")]
public static extern int tiledb_attribute_get_cell_size(tiledb_ctx_t* ctx, [NativeTypeName("const tiledb_attribute_t *")] tiledb_attribute_t* attr, [NativeTypeName("uint64_t *")] ulong* cell_size);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("int32_t")]
public static extern int tiledb_attribute_dump_str(tiledb_ctx_t* ctx, [NativeTypeName("const tiledb_attribute_t *")] tiledb_attribute_t* attr, tiledb_string_t** @out);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("int32_t")]
public static extern int tiledb_attribute_set_fill_value(tiledb_ctx_t* ctx, tiledb_attribute_t* attr, [NativeTypeName("const void *")] void* value, [NativeTypeName("uint64_t")] ulong size);
Expand Down Expand Up @@ -350,6 +354,10 @@ public static int tiledb_status([NativeTypeName("capi_return_t")] int x)
[return: NativeTypeName("int32_t")]
public static extern int tiledb_dimension_get_tile_extent(tiledb_ctx_t* ctx, [NativeTypeName("const tiledb_dimension_t *")] tiledb_dimension_t* dim, [NativeTypeName("const void **")] void** tile_extent);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("int32_t")]
public static extern int tiledb_dimension_dump_str(tiledb_ctx_t* ctx, [NativeTypeName("const tiledb_dimension_t *")] tiledb_dimension_t* dimension, tiledb_string_t** @out);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("int32_t")]
public static extern int tiledb_domain_alloc(tiledb_ctx_t* ctx, tiledb_domain_t** domain);
Expand Down Expand Up @@ -381,6 +389,10 @@ public static int tiledb_status([NativeTypeName("capi_return_t")] int x)
[return: NativeTypeName("int32_t")]
public static extern int tiledb_domain_has_dimension(tiledb_ctx_t* ctx, [NativeTypeName("const tiledb_domain_t *")] tiledb_domain_t* domain, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("int32_t *")] int* has_dim);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("int32_t")]
public static extern int tiledb_domain_dump_str(tiledb_ctx_t* ctx, [NativeTypeName("const tiledb_domain_t *")] tiledb_domain_t* domain, tiledb_string_t** @out);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("capi_return_t")]
public static extern int tiledb_object_type_to_str(tiledb_object_t object_type, [NativeTypeName("const char **")] sbyte** str);
Expand Down Expand Up @@ -788,6 +800,10 @@ public static int tiledb_status([NativeTypeName("capi_return_t")] int x)
[return: NativeTypeName("int32_t")]
public static extern int tiledb_array_schema_has_attribute(tiledb_ctx_t* ctx, [NativeTypeName("const tiledb_array_schema_t *")] tiledb_array_schema_t* array_schema, [NativeTypeName("const char *")] sbyte* name, [NativeTypeName("int32_t *")] int* has_attr);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("int32_t")]
public static extern int tiledb_array_schema_dump_str(tiledb_ctx_t* ctx, [NativeTypeName("const tiledb_array_schema_t *")] tiledb_array_schema_t* array_schema, tiledb_string_t** @out);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("int32_t")]
public static extern int tiledb_query_alloc(tiledb_ctx_t* ctx, tiledb_array_t* array, tiledb_query_type_t query_type, tiledb_query_t** query);
Expand Down Expand Up @@ -1351,6 +1367,18 @@ public static int tiledb_status([NativeTypeName("capi_return_t")] int x)
[return: NativeTypeName("capi_return_t")]
public static extern int tiledb_ndrectangle_set_range(tiledb_ctx_t* ctx, [NativeTypeName("tiledb_ndrectangle_t *")] tiledb_ndrectangle_handle_t* ndr, [NativeTypeName("uint32_t")] uint idx, tiledb_range_t* range);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("capi_return_t")]
public static extern int tiledb_ndrectangle_get_dtype(tiledb_ctx_t* ctx, [NativeTypeName("tiledb_ndrectangle_t *")] tiledb_ndrectangle_handle_t* ndr, [NativeTypeName("uint32_t")] uint idx, tiledb_datatype_t* type);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("capi_return_t")]
public static extern int tiledb_ndrectangle_get_dtype_from_name(tiledb_ctx_t* ctx, [NativeTypeName("tiledb_ndrectangle_t *")] tiledb_ndrectangle_handle_t* ndr, [NativeTypeName("const char *")] sbyte* name, tiledb_datatype_t* type);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("capi_return_t")]
public static extern int tiledb_ndrectangle_get_dim_num(tiledb_ctx_t* ctx, [NativeTypeName("tiledb_ndrectangle_t *")] tiledb_ndrectangle_handle_t* ndr, [NativeTypeName("uint32_t *")] uint* ndim);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("capi_return_t")]
public static extern int tiledb_current_domain_create(tiledb_ctx_t* ctx, [NativeTypeName("tiledb_current_domain_t **")] tiledb_current_domain_handle_t** current_domain);
Expand All @@ -1361,19 +1389,19 @@ public static int tiledb_status([NativeTypeName("capi_return_t")] int x)

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("capi_return_t")]
public static extern int tiledb_current_domain_set_ndrectangle([NativeTypeName("tiledb_current_domain_t *")] tiledb_current_domain_handle_t* current_domain, [NativeTypeName("tiledb_ndrectangle_t *")] tiledb_ndrectangle_handle_t* ndr);
public static extern int tiledb_current_domain_set_ndrectangle(tiledb_ctx_t* ctx, [NativeTypeName("tiledb_current_domain_t *")] tiledb_current_domain_handle_t* current_domain, [NativeTypeName("tiledb_ndrectangle_t *")] tiledb_ndrectangle_handle_t* ndr);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("capi_return_t")]
public static extern int tiledb_current_domain_get_ndrectangle([NativeTypeName("tiledb_current_domain_t *")] tiledb_current_domain_handle_t* current_domain, [NativeTypeName("tiledb_ndrectangle_t **")] tiledb_ndrectangle_handle_t** ndr);
public static extern int tiledb_current_domain_get_ndrectangle(tiledb_ctx_t* ctx, [NativeTypeName("tiledb_current_domain_t *")] tiledb_current_domain_handle_t* current_domain, [NativeTypeName("tiledb_ndrectangle_t **")] tiledb_ndrectangle_handle_t** ndr);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("capi_return_t")]
public static extern int tiledb_current_domain_get_is_empty([NativeTypeName("tiledb_current_domain_t *")] tiledb_current_domain_handle_t* current_domain, [NativeTypeName("uint32_t *")] uint* is_empty);
public static extern int tiledb_current_domain_get_is_empty(tiledb_ctx_t* ctx, [NativeTypeName("tiledb_current_domain_t *")] tiledb_current_domain_handle_t* current_domain, [NativeTypeName("uint32_t *")] uint* is_empty);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("capi_return_t")]
public static extern int tiledb_current_domain_get_type([NativeTypeName("tiledb_current_domain_t *")] tiledb_current_domain_handle_t* current_domain, tiledb_current_domain_type_t* type);
public static extern int tiledb_current_domain_get_type(tiledb_ctx_t* ctx, [NativeTypeName("tiledb_current_domain_t *")] tiledb_current_domain_handle_t* current_domain, tiledb_current_domain_type_t* type);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("capi_return_t")]
Expand Down Expand Up @@ -1410,6 +1438,10 @@ public static int tiledb_status([NativeTypeName("capi_return_t")] int x)
[return: NativeTypeName("capi_return_t")]
public static extern int tiledb_enumeration_get_offsets(tiledb_ctx_t* ctx, tiledb_enumeration_t* enumeration, [NativeTypeName("const void **")] void** offsets, [NativeTypeName("uint64_t *")] ulong* offsets_size);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("int32_t")]
public static extern int tiledb_enumeration_dump_str(tiledb_ctx_t* ctx, tiledb_enumeration_t* enumeration, tiledb_string_t** @out);

[DllImport("tiledb", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: NativeTypeName("int32_t")]
public static extern int tiledb_channel_operator_sum_get(tiledb_ctx_t* ctx, [NativeTypeName("const tiledb_channel_operator_t **")] tiledb_channel_operator_t** op);
Expand Down
4 changes: 2 additions & 2 deletions sources/TileDB.CSharp/TileDB.CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
<RootNamespace>TileDB.CSharp</RootNamespace>
<Version>5.15.0</Version>
<Version>5.16.0</Version>
<Description>C# wrapper of the TileDB Embedded universal data engine.</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<EnablePackageValidation>true</EnablePackageValidation>
<PackageValidationBaselineVersion>5.14.0</PackageValidationBaselineVersion>
<PackageValidationBaselineVersion>5.15.0</PackageValidationBaselineVersion>
<NoWarn>$(NoWarn);TILEDB0012;TILEDB0013;TILEDB0014</NoWarn>
</PropertyGroup>

Expand Down
7 changes: 7 additions & 0 deletions tests/TileDB.CSharp.Test/ArraySchemaTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ public void TestArraySchema()
filter0 = filter_list_return.Filter(0);
Assert.AreEqual(FilterType.Bzip2, filter0.FilterType());

// ToString() will call tiledb_array_schema_dump_str, which will return an informative string.
// Because the string's format is unspecified, we cannot fully parse it so we just check if
// it contains something it should definitely contain. The same applies to the other objects
// that can be dumped.
var dump = array_schema.ToString();
Assert.IsTrue(dump.Contains(nameof(ArrayType.Dense), StringComparison.OrdinalIgnoreCase));
teo-tsirpanis marked this conversation as resolved.
Show resolved Hide resolved

array_schema.Check();
}

Expand Down
4 changes: 4 additions & 0 deletions tests/TileDB.CSharp.Test/AttributeTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.IO;

namespace TileDB.CSharp.Test;
Expand Down Expand Up @@ -52,6 +53,9 @@
attribute.SetFillValue(12);
var value_size = attribute.FillValue<int>();
Assert.AreEqual(12, value_size[0]);

var dump = attribute.ToString();
Assert.IsTrue(dump.Contains(nameof(FilterType.Gzip), StringComparison.OrdinalIgnoreCase));
}

[TestMethod]
Expand Down Expand Up @@ -213,7 +217,7 @@

var query_write = new Query(array_write);
query_write.SetLayout(LayoutType.RowMajor);
// using var subarray = new Subarray(array_write);

Check warning on line 220 in tests/TileDB.CSharp.Test/AttributeTest.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (ubuntu-latest)

Remove this commented out code. (https://rules.sonarsource.com/csharp/RSPEC-125)

Check warning on line 220 in tests/TileDB.CSharp.Test/AttributeTest.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (macos-latest)

Remove this commented out code. (https://rules.sonarsource.com/csharp/RSPEC-125)

Check warning on line 220 in tests/TileDB.CSharp.Test/AttributeTest.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (windows-latest)

Remove this commented out code. (https://rules.sonarsource.com/csharp/RSPEC-125)
// subarray.SetSubarray(new int[] { 1, 4, 4, 4 });

query_write.SetDataBuffer("a1", a1_data);
Expand Down
4 changes: 4 additions & 0 deletions tests/TileDB.CSharp.Test/DimensionTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace TileDB.CSharp.Test;

Expand All @@ -17,6 +18,9 @@ public void TestDimension() {
Assert.AreEqual(extent, dimension.TileExtent<int>());
var dim_domain = dimension.GetDomain<int>();
Assert.AreEqual((1, 10), dim_domain);

var dump = dimension.ToString();
Assert.IsTrue(dump.Contains("test", StringComparison.Ordinal));
}

[TestMethod]
Expand Down
3 changes: 3 additions & 0 deletions tests/TileDB.CSharp.Test/DomainTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@ public void TestDomain() {
dim2 = domain.Dimension("testint");
Assert.AreEqual(DataType.Int32, dim2.Type());
Assert.AreEqual("testint", dim2.Name());

var dump = domain.ToString();
Assert.IsTrue(dump.Contains("testuint", StringComparison.Ordinal));
}
}
3 changes: 3 additions & 0 deletions tests/TileDB.CSharp.Test/EnumerationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public void TestFixedSize(uint cellValNum)
CollectionAssert.AreEqual(expectedValues, values);
CollectionAssert.AreEqual(new byte[] { 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0 }, rawData);
Assert.AreEqual(0, rawOffsets.Length);

var dump = e.ToString();
Assert.IsTrue(dump.Contains("test_fixed", StringComparison.Ordinal));
}

[TestMethod]
Expand Down
Loading