File tree Expand file tree Collapse file tree 2 files changed +12
-15
lines changed
vortex-layout/src/layouts/dict Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -115,12 +115,10 @@ impl VTable for DictVTable {
115115 // see [`SerdeVTable<DictVTable>::build`].
116116 . unwrap_or_else ( || dtype. nullability ( ) ) ;
117117 let codes = children. child ( 1 , & DType :: Primitive ( metadata. codes_ptype ( ) , codes_nullable) ) ?;
118- let all_values_referenced = metadata. all_values_referenced . unwrap_or ( false ) ;
119- Ok ( DictLayout :: new_with_metadata (
120- values,
121- codes,
122- all_values_referenced,
123- ) )
118+ Ok ( unsafe {
119+ DictLayout :: new ( values, codes)
120+ . set_all_values_referenced ( metadata. all_values_referenced . unwrap_or ( false ) )
121+ } )
124122 }
125123}
126124
@@ -138,18 +136,19 @@ pub struct DictLayout {
138136}
139137
140138impl DictLayout {
141- pub ( crate ) fn new_with_metadata (
142- values : LayoutRef ,
143- codes : LayoutRef ,
144- all_values_referenced : bool ,
145- ) -> Self {
139+ pub ( crate ) fn new ( values : LayoutRef , codes : LayoutRef ) -> Self {
146140 Self {
147141 values,
148142 codes,
149- all_values_referenced,
143+ all_values_referenced : false ,
150144 }
151145 }
152146
147+ pub unsafe fn set_all_values_referenced ( mut self , all_values_referenced : bool ) -> Self {
148+ self . all_values_referenced = all_values_referenced;
149+ self
150+ }
151+
153152 pub fn has_all_values_referenced ( & self ) -> bool {
154153 self . all_values_referenced
155154 }
Original file line number Diff line number Diff line change @@ -182,9 +182,7 @@ impl LayoutStrategy for DictStrategy {
182182 . map ( |result| {
183183 let ( codes_layout, values_layout) = result?;
184184 // All values are referenced when created via dictionary encoding
185- Ok :: < _ , VortexError > (
186- DictLayout :: new_with_metadata ( values_layout, codes_layout, true ) . into_layout ( ) ,
187- )
185+ Ok :: < _ , VortexError > ( DictLayout :: new ( values_layout, codes_layout) . into_layout ( ) )
188186 } )
189187 . try_collect :: < Vec < _ > > ( )
190188 . await ?;
You can’t perform that action at this time.
0 commit comments