CurtHagenlocher commented on issue #2265:
URL: https://github.com/apache/arrow-adbc/issues/2265#issuecomment-2426917353
The exception is being thrown when DuckDB releases a pointer that gets
passed to it. In my quick repro, the array in question claims to have three
children but only the first of the child pointers seems to be valid.
```
[Fact]
public async Task InsertFromFile()
{
// Write temporary file
Schema schema = new Schema([new Field("key", Int32Type.Default,
false), new Field("value", StringType.Default, false)], null);
RecordBatch recordBatch = new RecordBatch(schema, [
new Int32Array.Builder().AppendRange([1, 2, 3]).Build(),
new StringArray.Builder().AppendRange(["foo", "bar",
"baz"]).Build()
], 3);
string tempFile = _duckDb.CreateTempPath();
using (var writeFile = new FileStream(tempFile, FileMode.Create,
FileAccess.Write))
{
using var writer = new ArrowStreamWriter(writeFile, schema);
writer.WriteRecordBatch(recordBatch);
}
// Create database
using var database = _duckDb.OpenDatabase("insert_from_file.db");
using var connection = database.Connect(null);
using var statement = connection.BulkIngest("temp_table",
BulkIngestMode.Create);
// Read temporary file into new table
using var readStream = new FileStream(tempFile, FileMode.Open,
FileAccess.ReadWrite);
using var reader = new ArrowStreamReader(readStream);
statement.BindStream(reader);
await statement.ExecuteUpdateAsync();
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]