File tree 8 files changed +15
-16
lines changed
vortex-datafusion/src/persistent
8 files changed +15
-16
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,7 @@ use vortex::TryIntoArray;
20
20
use vortex:: dtype:: DType ;
21
21
use vortex:: dtype:: arrow:: FromArrowType ;
22
22
use vortex:: error:: { VortexError , vortex_err} ;
23
- use vortex:: file:: { DEFAULT_REGISTRY , VORTEX_FILE_EXTENSION , VortexWriteOptions } ;
24
- use vortex:: layout:: { LayoutRegistry , LayoutRegistryExt } ;
23
+ use vortex:: file:: { VORTEX_FILE_EXTENSION , VortexWriteOptions } ;
25
24
use vortex:: stream:: ArrayStreamAdapter ;
26
25
use vortex_datafusion:: persistent:: VortexFormat ;
27
26
@@ -222,10 +221,7 @@ pub async fn register_vortex_files(
222
221
. try_collect :: < Vec < _ > > ( )
223
222
. await ?;
224
223
225
- let format = Arc :: new ( VortexFormat :: new (
226
- DEFAULT_REGISTRY . clone ( ) ,
227
- Arc :: new ( LayoutRegistry :: default ( ) ) ,
228
- ) ) ;
224
+ let format = Arc :: new ( VortexFormat :: default ( ) ) ;
229
225
let table_path = vortex_dir
230
226
. to_str ( )
231
227
. ok_or_else ( || vortex_err ! ( "Path is not valid UTF-8" ) ) ?;
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ pub(crate) struct PyRegistry {
45
45
impl PyRegistry {
46
46
#[ new]
47
47
fn new ( ) -> Self {
48
- let mut array = ArrayRegistry :: default ( ) ;
48
+ let mut array = ArrayRegistry :: canonical_only ( ) ;
49
49
array. register_many ( DEFAULT_REGISTRY . vtables ( ) . cloned ( ) ) ;
50
50
let layout = LayoutRegistry :: default ( ) ;
51
51
Self {
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ use crate::vtable::VTableRef;
17
17
pub type ArrayContext = VTableContext < VTableRef > ;
18
18
pub type ArrayRegistry = VTableRegistry < VTableRef > ;
19
19
20
- impl Default for ArrayRegistry {
21
- fn default ( ) -> Self {
20
+ impl ArrayRegistry {
21
+ pub fn canonical_only ( ) -> Self {
22
22
let mut this = Self :: empty ( ) ;
23
23
24
24
// Register the canonical encodings
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ impl FileFormatFactory for VortexFormatFactory {
118
118
impl Default for VortexFormat {
119
119
fn default ( ) -> Self {
120
120
Self :: new (
121
- Arc :: new ( ArrayRegistry :: default ( ) ) ,
121
+ DEFAULT_REGISTRY . clone ( ) ,
122
122
Arc :: new ( LayoutRegistry :: default ( ) ) ,
123
123
)
124
124
}
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ mod forever_constant {
159
159
/// A default registry containing the built-in Vortex encodings and layouts.
160
160
pub static DEFAULT_REGISTRY : LazyLock < Arc < ArrayRegistry > > = LazyLock :: new ( || {
161
161
// Register the compressed encodings that Vortex ships with.
162
- let mut registry = ArrayRegistry :: default ( ) ;
162
+ let mut registry = ArrayRegistry :: canonical_only ( ) ;
163
163
registry. register_many ( [
164
164
ALPEncoding . vtable ( ) ,
165
165
ALPRDEncoding . vtable ( ) ,
Original file line number Diff line number Diff line change @@ -166,7 +166,9 @@ mod test {
166
166
. collect_to_buffer ( )
167
167
. unwrap ( ) ;
168
168
169
- let reader = SyncIPCReader :: try_new ( Cursor :: new ( ipc_buffer) , Default :: default ( ) ) . unwrap ( ) ;
169
+ let reader =
170
+ SyncIPCReader :: try_new ( Cursor :: new ( ipc_buffer) , ArrayRegistry :: canonical_only ( ) )
171
+ . unwrap ( ) ;
170
172
171
173
assert_eq ! ( reader. dtype( ) , array. dtype( ) ) ;
172
174
let result = reader. read_all ( ) . unwrap ( ) . to_primitive ( ) . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ mod test {
168
168
ipc_bytes. extend_from_slice ( buf. as_ref ( ) ) ;
169
169
}
170
170
171
- let mut decoder = MessageDecoder :: new ( ArrayRegistry :: default ( ) ) ;
171
+ let mut decoder = MessageDecoder :: new ( ArrayRegistry :: canonical_only ( ) ) ;
172
172
173
173
// Since we provide all bytes up-front, we should never hit a NeedMore.
174
174
let mut buffer = BytesMut :: from ( ipc_bytes. as_ref ( ) ) ;
Original file line number Diff line number Diff line change @@ -201,9 +201,10 @@ mod test {
201
201
. await
202
202
. unwrap ( ) ;
203
203
204
- let reader = AsyncIPCReader :: try_new ( Cursor :: new ( ipc_buffer) , Default :: default ( ) )
205
- . await
206
- . unwrap ( ) ;
204
+ let reader =
205
+ AsyncIPCReader :: try_new ( Cursor :: new ( ipc_buffer) , ArrayRegistry :: canonical_only ( ) )
206
+ . await
207
+ . unwrap ( ) ;
207
208
208
209
assert_eq ! ( reader. dtype( ) , array. dtype( ) ) ;
209
210
let result = reader. read_all ( ) . await . unwrap ( ) . to_primitive ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments