Skip to content

Commit ef429a6

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

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
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;

lib/representation/src/polars_to_rdf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::errors::RepresentationError;
22
use crate::multitype::{
3-
all_multi_main_cols, extract_column_from_multitype, MULTI_BLANK_DT, MULTI_IRI_DT, MULTI_NONE_DT,
3+
extract_column_from_multitype, MULTI_BLANK_DT, MULTI_IRI_DT, MULTI_NONE_DT,
44
};
55
use crate::rdf_to_polars::{
66
polars_literal_values_to_series, rdf_literal_to_polars_literal_value,

0 commit comments

Comments
 (0)