Skip to content

Commit eca996a

Browse files
committed
Fix GIL release for to_columns_string()
1 parent ff59bb9 commit eca996a

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

cpp/perspective/src/cpp/view.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,10 +1580,10 @@ View<t_ctxunit>::to_columns(t_uindex start_row, t_uindex end_row,
15801580
bool get_pkeys, bool get_ids, bool _leaves_only, t_uindex num_sides,
15811581
bool _has_row_path, std::string nidx, t_uindex columns_length,
15821582
t_uindex group_by_length) const {
1583-
1583+
PSP_GIL_UNLOCK();
1584+
PSP_READ_LOCK(get_lock());
15841585
auto slice = get_data(start_row, end_row, start_col, end_col);
1585-
auto col_names = slice->get_column_names();
1586-
auto schema = m_ctx->get_schema();
1586+
auto& col_names = slice->get_column_names();
15871587

15881588
rapidjson::StringBuffer s;
15891589
rapidjson::Writer<rapidjson::StringBuffer> writer(s);
@@ -1628,9 +1628,12 @@ View<t_ctx0>::to_columns(t_uindex start_row, t_uindex end_row,
16281628
bool get_pkeys, bool get_ids, bool _leaves_only, t_uindex num_sides,
16291629
bool _has_row_path, std::string nidx, t_uindex columns_length,
16301630
t_uindex group_by_length) const {
1631+
PSP_GIL_UNLOCK();
1632+
PSP_READ_LOCK(get_lock());
16311633
auto slice = get_data(start_row, end_row, start_col, end_col);
1632-
auto col_names = slice->get_column_names();
1633-
auto schema = m_ctx->get_schema();
1634+
const std::vector<std::vector<t_tscalar>>& col_names
1635+
= slice->get_column_names();
1636+
16341637
rapidjson::StringBuffer s;
16351638
rapidjson::Writer<rapidjson::StringBuffer> writer(s);
16361639
writer.StartObject();
@@ -1671,8 +1674,11 @@ View<t_ctx1>::to_columns(t_uindex start_row, t_uindex end_row,
16711674
bool get_pkeys, bool get_ids, bool leaves_only, t_uindex num_sides,
16721675
bool has_row_path, std::string nidx, t_uindex columns_length,
16731676
t_uindex group_by_length) const {
1677+
PSP_GIL_UNLOCK();
1678+
PSP_READ_LOCK(get_lock());
1679+
16741680
auto slice = get_data(start_row, end_row, start_col, end_col);
1675-
auto col_names = slice->get_column_names();
1681+
const auto& col_names = slice->get_column_names();
16761682
rapidjson::StringBuffer s;
16771683
rapidjson::Writer<rapidjson::StringBuffer> writer(s);
16781684
writer.StartObject();
@@ -1721,8 +1727,10 @@ View<t_ctx2>::to_columns(t_uindex start_row, t_uindex end_row,
17211727
bool get_pkeys, bool get_ids, bool leaves_only, t_uindex num_sides,
17221728
bool has_row_path, std::string nidx, t_uindex columns_length,
17231729
t_uindex group_by_length) const {
1724-
auto slice = get_data(start_row, end_row, start_col, end_col);
1725-
auto col_names = slice->get_column_names();
1730+
PSP_GIL_UNLOCK();
1731+
PSP_READ_LOCK(get_lock());
1732+
const auto slice = get_data(start_row, end_row, start_col, end_col);
1733+
const auto& col_names = slice->get_column_names();
17261734
rapidjson::StringBuffer s;
17271735
rapidjson::Writer<rapidjson::StringBuffer> writer(s);
17281736
writer.StartObject();

0 commit comments

Comments
 (0)