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.24. #433

Merged
merged 8 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
105 changes: 100 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 @@
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 All @@ -36,7 +36,7 @@

array.Close();

var unixTimestamp = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;

Check warning on line 39 in tests/TileDB.CSharp.Test/ArrayTest.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (ubuntu-latest)

Provide the "DateTimeKind" when creating this object. (https://rules.sonarsource.com/csharp/RSPEC-6562)

Check warning on line 39 in tests/TileDB.CSharp.Test/ArrayTest.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (ubuntu-latest)

Use "DateTime.UnixEpoch" instead of creating DateTime instances that point to the unix epoch time (https://rules.sonarsource.com/csharp/RSPEC-6588)

Check warning on line 39 in tests/TileDB.CSharp.Test/ArrayTest.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (macos-latest)

Provide the "DateTimeKind" when creating this object. (https://rules.sonarsource.com/csharp/RSPEC-6562)

Check warning on line 39 in tests/TileDB.CSharp.Test/ArrayTest.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (macos-latest)

Use "DateTime.UnixEpoch" instead of creating DateTime instances that point to the unix epoch time (https://rules.sonarsource.com/csharp/RSPEC-6588)

Check warning on line 39 in tests/TileDB.CSharp.Test/ArrayTest.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (windows-latest)

Provide the "DateTimeKind" when creating this object. (https://rules.sonarsource.com/csharp/RSPEC-6562)

Check warning on line 39 in tests/TileDB.CSharp.Test/ArrayTest.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (windows-latest)

Use "DateTime.UnixEpoch" instead of creating DateTime instances that point to the unix epoch time (https://rules.sonarsource.com/csharp/RSPEC-6588)
array.SetOpenTimestampStart((ulong)(unixTimestamp / 1000000));

array.Open(QueryType.Read);
Expand Down Expand Up @@ -75,7 +75,7 @@
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 All @@ -88,7 +88,7 @@

array.Close();

var unixTimestamp = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;

Check warning on line 91 in tests/TileDB.CSharp.Test/ArrayTest.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (ubuntu-latest)

Provide the "DateTimeKind" when creating this object. (https://rules.sonarsource.com/csharp/RSPEC-6562)
array.SetOpenTimestampStart((ulong)(unixTimestamp / 1000000));

array.Open(QueryType.Read);
Expand Down Expand Up @@ -133,7 +133,7 @@

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,102 @@
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));
}

/// <summary>
/// Base-64 encoded zip file of an array with an old format version.
/// </summary>
/// <remarks>
/// The array was taken from <see href="https://github.com/TileDB-Inc/TileDB-Py/blob/3ea00dbc2eabce972bea8af1ea8a4dc420e00a72/tiledb/tests/test_libtiledb.py#L311-L341"/>
/// and repackaged to a zip file, because <c>System.Formats.Tar</c> is available only in .NET 7+.
/// </remarks>
const string OldVersionArrayZip = """
UEsDBBQAAAAAAAQHtFIAAAAAAAAAAAAAAABDAAAAX18xNjIxNDYxMzY3OTcyXzE2MjE0NjEzNjc5
NzJfMWJlOWNlMDM3NDI1NGMyNGI2NjBlZDE3OGU3OWQ1ZTdfNS5va1BLAwQUAAAACAAEB7RSkZnF
iBEAAAAsAAAARQAAAF9fMTYyMTQ2MTM2Nzk3Ml8xNjIxNDYxMzY3OTcyXzFiZTljZTAzNzQyNTRj
MjRiNjYwZWQxNzhlNzlkNWU3XzUvLnRkYmNkgAAJKAYBRijNBKVZoTQAUEsDBBQAAAAIAAQHtFIu
OY4+jQAAAI0EAABYAAAAX18xNjIxNDYxMzY3OTcyXzE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AADYAQAAX18xNjIxNDYxMzY3
OTcyXzE2MjE0NjEzNjc5NzJfMWJlOWNlMDM3NDI1NGMyNGI2NjBlZDE3OGU3OWQ1ZTdfNS9kLnRk
YlBLAQIUABQAAAAAAKQJtFIAAAAAAAAAAAAAAABDAAAAAAAAAAAAIAAAAGICAABfXzE2MjE0NjIz
ODc4OTdfMTYyMTQ2MjM4Nzg5N185OWVkMTQ4MTM3OWU0NGU5ODdlNDUzNWFiMmFhMWIwY181Lm9r
UEsBAhQAFAAAAAgApAm0UpGZxYgRAAAALAAAAEUAAAAAAAAAAAAgAAAAwwIAAF9fMTYyMTQ2MjM4
Nzg5N18xNjIxNDYyMzg3ODk3Xzk5ZWQxNDgxMzc5ZTQ0ZTk4N2U0NTM1YWIyYWExYjBjXzUvLnRk
YlBLAQIUABQAAAAIAKQJtFIuOY4+jQAAAI0EAABYAAAAAAAAAAAAIAAAADcDAABfXzE2MjE0NjIz
ODc4OTdfMTYyMTQ2MjM4Nzg5N185OWVkMTQ4MTM3OWU0NGU5ODdlNDUzNWFiMmFhMWIwY181L19f
ZnJhZ21lbnRfbWV0YWRhdGEudGRiUEsBAhQAFAAAAAgApAm0Uohw0hMmAAAAQAAAAEYAAAAAAAAA
AAAgAAAAOgQAAF9fMTYyMTQ2MjM4Nzg5N18xNjIxNDYyMzg3ODk3Xzk5ZWQxNDgxMzc5ZTQ0ZTk4
N2U0NTM1YWIyYWExYjBjXzUvZC50ZGJQSwECFAAUAAAACAADB7RSw/odvGAAAACQAAAAEgAAAAAA
AAAAACAAAADEBAAAX19hcnJheV9zY2hlbWEudGRiUEsBAhQAFAAAAAAAAwe0UgAAAAAAAAAAAAAA
AAoAAAAAAAAAAAAgAAAAVAUAAF9fbG9jay50ZGJQSwUGAAAAAAoACgA0BAAAfAUAAAAA
""";

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

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

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
Contributor

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.


TestUtil.UnzipBase64String(uri, OldVersionArrayZip);

using (var schema = Array.LoadArraySchema(context, uri))
{
Assert.AreEqual(5u, schema.FormatVersion());
}

Array.UpgradeVersion(context, uri);

using (var schema = Array.LoadArraySchema(context, uri))
{
Assert.IsTrue(schema.FormatVersion() >= 15u, "Array was not upgraded.");
}
}

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 +294,7 @@
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
9 changes: 9 additions & 0 deletions tests/TileDB.CSharp.Test/TestUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.IO.Enumeration;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand All @@ -11,7 +12,7 @@

public static class TestUtil
{
static TestUtil()

Check warning on line 15 in tests/TileDB.CSharp.Test/TestUtil.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (windows-latest)

Initialize all 'static fields' inline and remove the 'static constructor'. (https://rules.sonarsource.com/csharp/RSPEC-3963)
{
if (!Directory.Exists(MakeTestPath("")))
{
Expand Down Expand Up @@ -104,7 +105,7 @@

foreach (var buffer in buffers)
{
// TODO: Remove cast to dynamic

Check warning on line 108 in tests/TileDB.CSharp.Test/TestUtil.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (ubuntu-latest)

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 108 in tests/TileDB.CSharp.Test/TestUtil.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (macos-latest)

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 108 in tests/TileDB.CSharp.Test/TestUtil.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (windows-latest)

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)
writeQuery.SetDataBuffer(buffer.Key, (dynamic)buffer.Value);
// Set offset buffer if the attribute or dimension is variable size
if (array.Schema().IsVarSize(buffer.Key))
Expand Down Expand Up @@ -169,7 +170,7 @@
readQuery.SetLayout(layout);
foreach (var buffer in buffers)
{
// TODO: Remove cast to dynamic

Check warning on line 173 in tests/TileDB.CSharp.Test/TestUtil.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (ubuntu-latest)

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 173 in tests/TileDB.CSharp.Test/TestUtil.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (macos-latest)

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 173 in tests/TileDB.CSharp.Test/TestUtil.cs

View workflow job for this annotation

GitHub Actions / Run-Tests (windows-latest)

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)
readQuery.SetDataBuffer(buffer.Key, (dynamic)buffer.Value);
// Set offset buffer if the attribute or dimension is variable size
if (array.Schema().IsVarSize(buffer.Key))
Expand Down Expand Up @@ -244,4 +245,12 @@
$"Nullable: {pair.Value.Nullable()};");
}
}

public static void UnzipBase64String(string path, string data)
{
byte[] bytes = Convert.FromBase64String(data);
using var stream = new MemoryStream(bytes, writable: false);
using var zipFile = new ZipArchive(stream, ZipArchiveMode.Read);
zipFile.ExtractToDirectory(path, overwriteFiles: false);
}
}
Loading