This is an automated email from the ASF dual-hosted git repository.
curth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new 9a10e6791 fix(csharp/src): Add missing override to
ImportedAdbcConnection (#2577)
9a10e6791 is described below
commit 9a10e6791db6d54b813fde4df3925c354822192e
Author: Curt Hagenlocher <[email protected]>
AuthorDate: Wed Mar 5 06:06:55 2025 -0800
fix(csharp/src): Add missing override to ImportedAdbcConnection (#2577)
An override was missing from `ImportedAdbcConnection`.
---
.../src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs | 34 ++++++++++++++++++++++
.../Apache.Arrow.Adbc.Tests/ImportedDuckDbTests.cs | 12 ++++++++
2 files changed, 46 insertions(+)
diff --git a/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs
b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs
index e84250e86..73ae28b7d 100644
--- a/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs
+++ b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs
@@ -683,6 +683,40 @@ namespace Apache.Arrow.Adbc.C
}
}
+ public override AdbcStatement BulkIngest(
+ string? targetCatalog,
+ string? targetDbSchema,
+ string targetTableName,
+ BulkIngestMode mode,
+ bool isTemporary)
+ {
+ AdbcStatement statement = CreateStatement();
+ bool succeeded = false;
+ try
+ {
+ statement.SetOption(AdbcOptions.Ingest.TargetTable,
targetTableName);
+ if (targetCatalog != null)
+ {
+ statement.SetOption(AdbcOptions.Ingest.TargetCatalog,
targetCatalog);
+ }
+ if (targetDbSchema != null)
+ {
+ statement.SetOption(AdbcOptions.Ingest.TargetDbSchema,
targetDbSchema);
+ }
+ if (isTemporary)
+ {
+ statement.SetOption(AdbcOptions.Ingest.Temporary,
AdbcOptions.GetEnabled(isTemporary));
+ }
+ statement.SetOption(AdbcOptions.Ingest.Mode,
AdbcOptions.GetIngestMode(mode));
+ succeeded = true;
+ return statement;
+ }
+ finally
+ {
+ if (!succeeded) { statement.Dispose(); }
+ }
+ }
+
public unsafe override void Commit()
{
using (CallHelper caller = new CallHelper())
diff --git a/csharp/test/Apache.Arrow.Adbc.Tests/ImportedDuckDbTests.cs
b/csharp/test/Apache.Arrow.Adbc.Tests/ImportedDuckDbTests.cs
index 49d7af019..d5ad20c9c 100644
--- a/csharp/test/Apache.Arrow.Adbc.Tests/ImportedDuckDbTests.cs
+++ b/csharp/test/Apache.Arrow.Adbc.Tests/ImportedDuckDbTests.cs
@@ -195,6 +195,18 @@ namespace Apache.Arrow.Adbc.Tests
statement2.ExecuteUpdate();
Assert.Equal(5, GetResultCount(statement2, "SELECT * from
ingested"));
+
+ // TODO: Pass a schema once the DuckDB "quoting identifiers" bug
has been fixed
+ using var statement3 = connection.BulkIngest(null, null,
"ingested", BulkIngestMode.Append, isTemporary: false);
+
+ recordBatch = new RecordBatch(schema, [
+ new Int32Array.Builder().AppendRange([6]).Build(),
+ new
StringArray.Builder().AppendRange(["antidisestablishmentarianism"]).Build()
+ ], 1);
+ statement3.Bind(recordBatch, schema);
+ statement3.ExecuteUpdate();
+
+ Assert.Equal(6, GetResultCount(statement3, "SELECT * from
main.ingested"));
}
[Fact]