Skip to content

Commit 9a10e67

Browse files
fix(csharp/src): Add missing override to ImportedAdbcConnection (#2577)
An override was missing from `ImportedAdbcConnection`.
1 parent bc66e4e commit 9a10e67

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,40 @@ public override AdbcStatement BulkIngest(string targetTableName, BulkIngestMode
683683
}
684684
}
685685

686+
public override AdbcStatement BulkIngest(
687+
string? targetCatalog,
688+
string? targetDbSchema,
689+
string targetTableName,
690+
BulkIngestMode mode,
691+
bool isTemporary)
692+
{
693+
AdbcStatement statement = CreateStatement();
694+
bool succeeded = false;
695+
try
696+
{
697+
statement.SetOption(AdbcOptions.Ingest.TargetTable, targetTableName);
698+
if (targetCatalog != null)
699+
{
700+
statement.SetOption(AdbcOptions.Ingest.TargetCatalog, targetCatalog);
701+
}
702+
if (targetDbSchema != null)
703+
{
704+
statement.SetOption(AdbcOptions.Ingest.TargetDbSchema, targetDbSchema);
705+
}
706+
if (isTemporary)
707+
{
708+
statement.SetOption(AdbcOptions.Ingest.Temporary, AdbcOptions.GetEnabled(isTemporary));
709+
}
710+
statement.SetOption(AdbcOptions.Ingest.Mode, AdbcOptions.GetIngestMode(mode));
711+
succeeded = true;
712+
return statement;
713+
}
714+
finally
715+
{
716+
if (!succeeded) { statement.Dispose(); }
717+
}
718+
}
719+
686720
public unsafe override void Commit()
687721
{
688722
using (CallHelper caller = new CallHelper())

csharp/test/Apache.Arrow.Adbc.Tests/ImportedDuckDbTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,18 @@ public void IngestData()
195195
statement2.ExecuteUpdate();
196196

197197
Assert.Equal(5, GetResultCount(statement2, "SELECT * from ingested"));
198+
199+
// TODO: Pass a schema once the DuckDB "quoting identifiers" bug has been fixed
200+
using var statement3 = connection.BulkIngest(null, null, "ingested", BulkIngestMode.Append, isTemporary: false);
201+
202+
recordBatch = new RecordBatch(schema, [
203+
new Int32Array.Builder().AppendRange([6]).Build(),
204+
new StringArray.Builder().AppendRange(["antidisestablishmentarianism"]).Build()
205+
], 1);
206+
statement3.Bind(recordBatch, schema);
207+
statement3.ExecuteUpdate();
208+
209+
Assert.Equal(6, GetResultCount(statement3, "SELECT * from main.ingested"));
198210
}
199211

200212
[Fact]

0 commit comments

Comments
 (0)