@@ -17,14 +17,12 @@ use futures::pin_mut;
1717use futures:: select;
1818use itertools:: Itertools ;
1919use vortex_array:: ArrayContext ;
20- use vortex_array:: ArrayId ;
2120use vortex_array:: ArrayRef ;
2221use vortex_array:: dtype:: DType ;
2322use vortex_array:: dtype:: FieldPath ;
2423use vortex_array:: expr:: stats:: Stat ;
2524use vortex_array:: iter:: ArrayIterator ;
2625use vortex_array:: iter:: ArrayIteratorExt ;
27- use vortex_array:: session:: ArrayRegistry ;
2826use vortex_array:: session:: ArraySessionExt ;
2927use vortex_array:: stats:: PRUNING_STATS ;
3028use vortex_array:: stream:: ArrayStream ;
@@ -80,37 +78,17 @@ pub trait WriteOptionsSessionExt: SessionExt {
8078 /// Create [`VortexWriteOptions`] for writing to a Vortex file.
8179 fn write_options ( & self ) -> VortexWriteOptions {
8280 let session = self . session ( ) ;
83- let strategy = default_write_strategy ( & session) ;
84- VortexWriteOptions {
85- strategy,
86- session,
87- exclude_dtype : false ,
88- file_statistics : PRUNING_STATS . to_vec ( ) ,
89- max_variable_length_statistics_size : 64 ,
90- }
81+ VortexWriteOptions :: new ( session)
9182 }
9283}
9384impl < S : SessionExt > WriteOptionsSessionExt for S { }
9485
95- fn default_write_strategy ( session : & VortexSession ) -> Arc < dyn LayoutStrategy > {
96- WriteStrategyBuilder :: default ( )
97- . with_allow_encodings ( session. enabled_encoding_ids ( ) . into_iter ( ) . collect ( ) )
98- . build ( )
99- }
100-
101- fn initial_array_ids ( session : & VortexSession , registry : & ArrayRegistry ) -> Vec < ArrayId > {
102- session
103- . enabled_encoding_ids ( )
104- . into_iter ( )
105- . filter ( |id| registry. find ( id) . is_some ( ) )
106- . sorted ( )
107- . collect ( )
108- }
109-
11086impl VortexWriteOptions {
11187 /// Create a new [`VortexWriteOptions`] with the given session.
11288 pub fn new ( session : VortexSession ) -> Self {
113- let strategy = default_write_strategy ( & session) ;
89+ let strategy = WriteStrategyBuilder :: default ( )
90+ . with_allow_encodings ( session. enabled_encoding_ids ( ) . into_iter ( ) . collect ( ) )
91+ . build ( ) ;
11492 VortexWriteOptions {
11593 strategy,
11694 session,
@@ -180,11 +158,10 @@ impl VortexWriteOptions {
180158 // Pre-populate the array context with the registered encodings selected by the enabled
181159 // editions. This keeps the serialized ordering deterministic without advertising every
182160 // encoding the session happens to know how to read.
183- let array_registry = self . session . arrays ( ) . registry ( ) . clone ( ) ;
184- let ctx = ArrayContext :: new ( initial_array_ids ( & self . session , & array_registry) )
161+ let ctx = ArrayContext :: new ( self . session . enabled_encoding_ids ( ) )
185162 // The registry supplies serialization implementations; the layout strategy applies
186163 // the enabled-edition write policy before arrays reach serialization.
187- . with_registry ( array_registry ) ;
164+ . with_registry ( self . session . arrays ( ) . registry ( ) . clone ( ) ) ;
188165 let dtype = stream. dtype ( ) . clone ( ) ;
189166
190167 let ( mut ptr, eof) = SequenceId :: root ( ) . split ( ) ;
@@ -565,8 +542,6 @@ mod tests {
565542 use vortex_edition:: EditionSession ;
566543 use vortex_edition:: EditionSessionExt ;
567544
568- use super :: initial_array_ids;
569-
570545 #[ test]
571546 fn initial_array_ids_are_registered_and_enabled ( ) -> Result < ( ) , vortex_edition:: EditionError > {
572547 const EDITION : EditionId = EditionId :: new ( "test" , 2026 , 7 , 0 ) ;
@@ -583,7 +558,7 @@ mod tests {
583558 session. enable_edition ( EDITION ) ?;
584559
585560 let registry = session. arrays ( ) . registry ( ) . clone ( ) ;
586- let ids = initial_array_ids ( & session, & registry ) ;
561+ let ids = session. enabled_encoding_ids ( ) ;
587562 assert_eq ! ( ids, [ Primitive . id( ) ] ) ;
588563 assert ! ( !ids. contains( & Bool . id( ) ) ) ;
589564 Ok ( ( ) )
0 commit comments