diff --git a/lib/src/webdb.cc b/lib/src/webdb.cc index c93e633d3..e728c7e31 100644 --- a/lib/src/webdb.cc +++ b/lib/src/webdb.cc @@ -104,6 +104,7 @@ arrow::Result> WebDB::Connection::MaterializeQuer // Configure the output writer ArrowSchema raw_schema; ClientProperties options; + unordered_map> extension_type_cast; options.arrow_offset_size = ArrowOffsetSize::REGULAR; ArrowConverter::ToArrowSchema(&raw_schema, result->types, result->names, options); ARROW_ASSIGN_OR_RAISE(auto schema, arrow::ImportSchema(&raw_schema)); @@ -118,7 +119,7 @@ arrow::Result> WebDB::Connection::MaterializeQuer for (auto chunk = result->Fetch(); !!chunk && chunk->size() > 0; chunk = result->Fetch()) { // Import the data chunk as record batch ArrowArray array; - ArrowConverter::ToArrowArray(*chunk, &array, options); + ArrowConverter::ToArrowArray(*chunk, &array, options, extension_type_cast); // Import the record batch ARROW_ASSIGN_OR_RAISE(auto batch, arrow::ImportRecordBatch(&array, schema)); // Patch the record batch @@ -251,8 +252,9 @@ arrow::Result> WebDB::Connection::FetchQueryResul // Serialize the record batch ArrowArray array; ClientProperties arrow_options; + unordered_map> extension_type_cast; arrow_options.arrow_offset_size = ArrowOffsetSize::REGULAR; - ArrowConverter::ToArrowArray(*chunk, &array, arrow_options); + ArrowConverter::ToArrowArray(*chunk, &array, arrow_options, extension_type_cast); ARROW_ASSIGN_OR_RAISE(auto batch, arrow::ImportRecordBatch(&array, current_schema_)); // Patch the record batch ARROW_ASSIGN_OR_RAISE(batch, patchRecordBatch(batch, current_schema_patched_, webdb_.config_->query)); diff --git a/patches/duckdb/add_constructor_client_properties.patch b/patches/duckdb/add_constructor_client_properties.patch new file mode 100644 index 000000000..b3d7fc6f4 --- /dev/null +++ b/patches/duckdb/add_constructor_client_properties.patch @@ -0,0 +1,12 @@ +diff --git a/src/include/duckdb/main/client_properties.hpp b/src/include/duckdb/main/client_properties.hpp +index a4038a7353..d3a269ea36 100644 +--- a/src/include/duckdb/main/client_properties.hpp ++++ b/src/include/duckdb/main/client_properties.hpp +@@ -26,6 +26,7 @@ struct ClientProperties { + arrow_use_list_view(arrow_use_list_view_p), produce_arrow_string_view(produce_arrow_string_view_p), + arrow_lossless_conversion(lossless_conversion), client_context(client_context) { + } ++ ClientProperties() {} + + string time_zone = "UTC"; + ArrowOffsetSize arrow_offset_size = ArrowOffsetSize::REGULAR;