Skip to content

Commit 211a612

Browse files
committed
representation/multitype/extract_column_from_multitype: drop the fields used to build the struct before realizing it
1 parent b14ed17 commit 211a612

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/representation/src/multitype.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use polars::datatypes::PlSmallStr;
55
use polars::prelude::{
66
all_horizontal, as_struct, col, lit, when, CategoricalOrdering, Column, DataFrame, DataType,
77
Expr, IntoColumn, IntoLazy, JoinArgs, JoinType, LazyFrame, LazyGroupBy, LiteralValue,
8-
MaintainOrderJoin, UniqueKeepStrategy,
8+
MaintainOrderJoin, Selector, UniqueKeepStrategy,
99
};
1010

1111
use std::collections::{HashMap, HashSet};
@@ -65,6 +65,15 @@ pub fn extract_column_from_multitype(
6565
])
6666
.alias(&colname),
6767
);
68+
// The LANG_STRING_VALUE_FIELD is what is used to store
69+
// the struct containing { LANG_STRING_LANG_FIELD, LANG_STRING_VALUE_FIELD }
70+
lf = lf.drop(
71+
[
72+
Selector::new(col(LANG_STRING_LANG_FIELD)),
73+
// Selector::new(col(LANG_STRING_VALUE_FIELD)),
74+
]
75+
.into_iter(),
76+
);
6877
let df = lf.collect();
6978
let ser = df.unwrap().drop_in_place(&colname).unwrap();
7079
return ser;

0 commit comments

Comments
 (0)