Skip to content

Commit 6fa9724

Browse files
committed
Revert "avoid deadlocking on the context lock"
This reverts commit 8227efc.
1 parent 814677e commit 6fa9724

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

src/common/arrow/arrow_converter.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,8 @@ void ArrowConverter::ToArrowSchema(ArrowSchema *out_schema, const vector<Logical
418418
D_ASSERT(out_schema);
419419
D_ASSERT(types.size() == names.size());
420420
D_ASSERT(options.client_context);
421-
auto get_schema_func = [&types, &out_schema, &names, &options]() {
421+
// We need to run this in a transaction. The arrow schema callback might use the catalog to do lookups.
422+
options.client_context->RunFunctionInTransaction([&types, &out_schema, &names, &options]() {
422423
const idx_t column_count = types.size();
423424
// Allocate as unique_ptr first to clean-up properly on error
424425
auto root_holder = make_uniq<DuckDBArrowSchemaHolder>();
@@ -450,14 +451,7 @@ void ArrowConverter::ToArrowSchema(ArrowSchema *out_schema, const vector<Logical
450451
// Release ownership to caller
451452
out_schema->private_data = root_holder.release();
452453
out_schema->release = ReleaseDuckDBArrowSchema;
453-
};
454-
auto &context = *options.client_context;
455-
if (context.transaction.HasActiveTransaction()) {
456-
get_schema_func();
457-
} else {
458-
// We need to run this in a transaction. The arrow schema callback might use the catalog to do lookups.
459-
options.client_context->RunFunctionInTransaction(get_schema_func);
460-
}
454+
});
461455
}
462456

463457
} // namespace duckdb

0 commit comments

Comments
 (0)