Skip to content

Commit

Permalink
fix(csharp/src): Add missing override to ImportedAdbcConnection (#2577)
Browse files Browse the repository at this point in the history
An override was missing from `ImportedAdbcConnection`.
  • Loading branch information
CurtHagenlocher authored Mar 5, 2025
1 parent bc66e4e commit 9a10e67
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
34 changes: 34 additions & 0 deletions csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,40 @@ public override AdbcStatement BulkIngest(string targetTableName, BulkIngestMode
}
}

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())
Expand Down
12 changes: 12 additions & 0 deletions csharp/test/Apache.Arrow.Adbc.Tests/ImportedDuckDbTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,18 @@ public void IngestData()
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]
Expand Down

0 comments on commit 9a10e67

Please sign in to comment.