Skip to content

Commit

Permalink
fix: fixed tokio runtime drop issue (#36)
Browse files Browse the repository at this point in the history
* scaffolded deploy to production action

* chore: updated delta-rs version and fixed breaking changes

* decremented assembly version

* reverted accidental overwrite of build

* fix: fixed tokio runtime drop issue
  • Loading branch information
mightyshazam authored May 1, 2024
1 parent 6015dc2 commit 6cd7405
Show file tree
Hide file tree
Showing 9 changed files with 480 additions and 383 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ bin/
obj/
/.vs
/.vscode
.mono/
.idea/
target/
src/DeltaLake.ApiDoc/_site
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<PropertyGroup>
<Version>1.0.0</Version>
<Version>0.1.0</Version>
<!--
.NET does not allow the above version format for AssemblyVersion, and this
is the version used in gRPC headers. The format is
Expand All @@ -28,7 +28,7 @@
and 0.2.0 then is 0.2.0.5. But if there is no prerelease version, just
leave revision off.
-->
<AssemblyVersion>1.0.0</AssemblyVersion>
<AssemblyVersion>0.1.0</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
61 changes: 36 additions & 25 deletions examples/local/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
Expand All @@ -15,33 +16,43 @@ public class Program
public static async Task Main(string[] args)
{
var uri = args[0];
using var runtime = new DeltaRuntime(RuntimeOptions.Default);
var builder = new Apache.Arrow.Schema.Builder();
builder.Field(fb =>
int length;
if (args.Length < 2 || !int.TryParse(args[1], out length))
{
fb.Name("test");
fb.DataType(Int32Type.Default);
fb.Nullable(false);
});
var schema = builder.Build();
var allocator = new NativeMemoryAllocator();
var recordBatchBuilder = new RecordBatch.Builder(allocator)
.Append("test", false, col => col.Int32(arr => arr.AppendRange(Enumerable.Range(0, length))));
using var table = await DeltaTable.CreateAsync(
runtime,
new TableCreateOptions(uri, schema)
length = 10;
}

var runtime = new DeltaRuntime(RuntimeOptions.Default);
{
var builder = new Apache.Arrow.Schema.Builder();
builder.Field(fb =>
{
Configuration = new Dictionary<string, string?>
fb.Name("test");
fb.DataType(Int32Type.Default);
fb.Nullable(false);
});
var schema = builder.Build();
var allocator = new NativeMemoryAllocator();
var recordBatchBuilder = new RecordBatch.Builder(allocator)
.Append("test", false, col => col.Int32(arr => arr.AppendRange(Enumerable.Range(0, length))));
using var table = await DeltaTable.CreateAsync(
runtime,
new TableCreateOptions(uri, schema)
{
["delta.dataSkippingNumIndexedCols"] = "32",
["delta.setTransactionRetentionDuration"] = null,
}
},
CancellationToken.None);
var options = new InsertOptions
{
SaveMode = SaveMode.Append,
};
await table.InsertAsync([recordBatchBuilder.Build()], schema, options, CancellationToken.None);
Configuration = new Dictionary<string, string?>
{
["delta.dataSkippingNumIndexedCols"] = "32",
["delta.setTransactionRetentionDuration"] = null,
}
},
CancellationToken.None);
var options = new InsertOptions
{
SaveMode = SaveMode.Append,
};
await table.InsertAsync([recordBatchBuilder.Build()], schema, options, CancellationToken.None);
}

runtime.Dispose();
}
}
Loading

0 comments on commit 6cd7405

Please sign in to comment.