Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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.23, dev]
tag: [release-2.24, dev]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout TileDB
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
strategy:
fail-fast: false
matrix:
tag: [release-2.23, dev]
tag: [release-2.24, dev]
runs-on: ubuntu-latest
steps:
- name: Checkout TileDB-CSharp
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
tag: [release-2.23, dev]
tag: [release-2.24, 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>23</TileDBNativeVersionMinor>
<TileDBNativeVersionMinor>24</TileDBNativeVersionMinor>
<TileDBNativePackageVersion>[$(TileDBNativeVersionMajor).$(TileDBNativeVersionMinor).0,$(TileDBNativeVersionMajor).$([MSBuild]::Add($(TileDBNativeVersionMinor), 1)).0)</TileDBNativePackageVersion>

<!-- The DevelopmentBuild property switches to the locally built native packages.
Expand Down
26 changes: 26 additions & 0 deletions sources/TileDB.CSharp/Array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,18 @@ public void Create(ArraySchema schema)
Create(_ctx, _uri, schema);
}

/// <summary>
/// Deletes an array from storage.
/// </summary>
/// <param name="ctx">The <see cref="CSharp.Context"/> to use.</param>
/// <param name="uri">The array's URI.</param>
public static void Delete(Context ctx, string uri)
{
using var msUri = new MarshaledString(uri);
using var ctxHandle = ctx.Handle.Acquire();
ctx.handle_error(Methods.tiledb_array_delete(ctxHandle, msUri));
}

/// <summary>
/// Applies an <see cref="ArraySchemaEvolution"/> to the schema of an array.
/// </summary>
Expand Down Expand Up @@ -367,6 +379,20 @@ public void Evolve(ArraySchemaEvolution schemaEvolution)
Evolve(_ctx, _uri, schemaEvolution);
}

/// <summary>
/// Upgrades the storage format version of an array.
/// </summary>
/// <param name="ctx">The <see cref="CSharp.Context"/> to use.</param>
/// <param name="uri">The array's URI.</param>
/// <param name="config">Optional <see cref="CSharp.Config"/> to customize the process.</param>
public static void UpgradeVersion(Context ctx, string uri, Config? config = null)
{
using var msUri = new MarshaledString(uri);
using var ctxHandle = ctx.Handle.Acquire();
using var configHandle = config?.Handle.Acquire() ?? default;
ctx.handle_error(Methods.tiledb_array_upgrade_version(ctxHandle, msUri, configHandle));
}

/// <summary>
/// Consolidates an array.
/// </summary>
Expand Down
222 changes: 111 additions & 111 deletions sources/TileDB.CSharp/Interop/Methods.cs

Large diffs are not rendered by default.

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.13.0</Version>
<Version>5.14.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.12.0</PackageValidationBaselineVersion>
<PackageValidationBaselineVersion>5.13.0</PackageValidationBaselineVersion>
<NoWarn>$(NoWarn);TILEDB0012;TILEDB0013;TILEDB0014</NoWarn>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions sources/TileDB.CSharp/VFS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public List<string> GetChildren(string uri)
/// <returns>A <see cref="List{T}"/> containing the files of the directory in <paramref name="uri"/>
/// and their sizes.</returns>
/// <remarks>
/// This operation is supported only on URIs to AWS S3.
/// This operation is supported only on URIs to local file system, S3, Azure and GCS.
/// </remarks>
public List<(string Uri, ulong Size)> GetChildrenRecursive(string uri)
{
Expand Down Expand Up @@ -439,7 +439,7 @@ public void VisitChildren<T>(string uri, Func<string, T, bool> callback, T callb
/// <param name="callbackArg">An argument that will be passed to <paramref name="callback"/>.</param>
/// <typeparam name="T">The type of <paramref name="callbackArg"/>.</typeparam>
/// <remarks>
/// This operation is supported only on local filesystem and AWS S3 URIs.
/// This operation is supported only on URIs to local file system, S3, Azure and GCS.
/// </remarks>
public void VisitChildrenRecursive<T>(string uri, Func<string, ulong, T, bool> callback, T callbackArg)
{
Expand Down
46 changes: 41 additions & 5 deletions tests/TileDB.CSharp.Test/ArrayTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void TestDenseArray()
var array = new Array(context, tmpArrayPath);
Assert.IsNotNull(array);

var array_schema = BuildDenseArraySchema(context);
var array_schema = ArrayTest.BuildDenseArraySchema(context);
Assert.IsNotNull(array_schema);

array.Create(array_schema);
Expand Down Expand Up @@ -75,7 +75,7 @@ public void TestSparseArray()
var array = new Array(context, tmpArrayPath);
Assert.IsNotNull(array);

var array_schema = BuildSparseArraySchema(context);
var array_schema = ArrayTest.BuildSparseArraySchema(context);
Assert.IsNotNull(array_schema);

array.Create(array_schema);
Expand Down Expand Up @@ -133,7 +133,7 @@ public void TestConsolidateFragments()

using var uri = new TemporaryDirectory("array_consolidate_fragments");

using (var schema = BuildDenseArraySchema(context))
using (var schema = ArrayTest.BuildDenseArraySchema(context))
using (var array = new Array(context, uri))
{
array.Create(schema);
Expand Down Expand Up @@ -170,7 +170,43 @@ public void TestConsolidateFragments()
Assert.AreEqual(FragmentCount, fragmentInfo.FragmentToVacuumCount);
}

private ArraySchema BuildDenseArraySchema(Context context)
[TestMethod]
public void TestDelete()
{
var context = Context.GetDefault();

using var uri = new TemporaryDirectory("array_delete");

using (var schema = BuildDenseArraySchema(context))
{
Array.Create(context, uri, schema);
}

Assert.AreEqual(ObjectType.Array, context.GetObjectType(uri));

Array.Delete(context, uri);

Assert.AreEqual(ObjectType.Invalid, context.GetObjectType(uri));
}

[TestMethod]
public void TestUpgradeVersion()
{
var context = Context.GetDefault();

using var uri = new TemporaryDirectory("array_upgrade_version");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it will be upgraded 😬 aside from S3 or committing the array though I'm not sure how we could test it with an array from a previous format version. Any ideas?

https://github.com/TileDB-Inc/TileDB/blob/93220d7c3041fcd05fdbf8a45cc9969f47aaf763/tiledb/sm/array/array.cc#L2161

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this test only calls the function to check that nothing catastrophic happened. We could check in an empty array with an older format version (just the schema file would be tiny), but I am slightly to moderately against this.

The Python API is doing something interesting. 👀

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice find! The format version is the first field in the array schema on disk.. Could we create an array and then adjust the first 4 bytes to set an older version?

https://github.com/TileDB-Inc/TileDB/blob/dev/format_spec/array_schema.md#array-schema-file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't do that easily because the schema is compressed, and it would be very fragile either way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the test.


using (var schema = BuildDenseArraySchema(context))
{
Array.Create(context, uri, schema);
}

Assert.AreEqual(ObjectType.Array, context.GetObjectType(uri));

Array.UpgradeVersion(context, uri);
}

private static ArraySchema BuildDenseArraySchema(Context context)
{
var dimension = Dimension.Create<short>(context, "dim1", 1, 10, 5);
Assert.IsNotNull(dimension);
Expand Down Expand Up @@ -199,7 +235,7 @@ private ArraySchema BuildDenseArraySchema(Context context)
return array_schema;
}

private ArraySchema BuildSparseArraySchema(Context context)
private static ArraySchema BuildSparseArraySchema(Context context)
{
var dim1 = Dimension.Create<short>(context, "dim1", 1, 10, 5);
Assert.IsNotNull(dim1);
Expand Down