@@ -607,6 +607,9 @@ View<CTX_T>::to_arrow(
607607 bool emit_group_by,
608608 bool compress
609609) const {
610+ PSP_GIL_UNLOCK ();
611+ PSP_READ_LOCK (*get_lock ());
612+
610613 std::shared_ptr<t_data_slice<CTX_T >> data_slice =
611614 get_data (start_row, end_row, start_col, end_col);
612615 return data_slice_to_arrow (data_slice, emit_group_by, compress);
@@ -620,6 +623,8 @@ View<t_ctx2>::to_csv(
620623 std::int32_t start_col,
621624 std::int32_t end_col
622625) const {
626+ PSP_GIL_UNLOCK ();
627+ PSP_READ_LOCK (*get_lock ());
623628
624629 // See generic instance.
625630 if (is_column_only () && m_ctx->unity_get_column_count () == 0 ) {
@@ -639,6 +644,8 @@ View<t_ctx1>::to_csv(
639644 std::int32_t start_col,
640645 std::int32_t end_col
641646) const {
647+ PSP_GIL_UNLOCK ();
648+ PSP_READ_LOCK (*get_lock ());
642649 std::shared_ptr<t_data_slice<t_ctx1>> data_slice =
643650 get_data (start_row, end_row, start_col, end_col);
644651 return data_slice_to_csv (data_slice);
@@ -652,9 +659,11 @@ View<CTX_T>::to_csv(
652659 std::int32_t start_col,
653660 std::int32_t end_col
654661) const {
662+ PSP_GIL_UNLOCK ();
663+ PSP_READ_LOCK (*get_lock ());
655664
656- // Arrow has a big whih miscalculates CSV header size as 1 when there are no
657- // columns (and hence no rows) in the dataset, so intercept these calls/
665+ // Arrow has a bug which miscalculates CSV header size as 1 when there are
666+ // no columns (and hence no rows) in the dataset, so intercept these calls/
658667 if (m_ctx->unity_get_column_count () == 0 ) {
659668 return std::make_shared<std::string>(" " );
660669 }
0 commit comments