@@ -249,12 +249,8 @@ impl ArrowSession {
249249
250250 /// Build the Arrow [`Field`] for a Vortex [`DType`].
251251 ///
252- /// For [`DType::Extension`]s, plugins registered against the extension's Vortex Id
252+ /// For [`DType::Extension`]s, plugins registered against the extension's `Id`
253253 /// are tried in registration order; the first plugin to return `Some(field)` wins.
254- /// If every registered plugin returns `None` (or none are registered) the field is
255- /// built from [`Self::to_arrow_data_type`]. Container types ([`DType::List`],
256- /// [`DType::FixedSizeList`], [`DType::Struct`]) recurse through this method so
257- /// extension metadata on nested fields is preserved.
258254 pub fn to_arrow_field ( & self , name : & str , dtype : & DType ) -> VortexResult < Field > {
259255 // Handle the structural encodings, which may have recursive types
260256 match dtype {
@@ -304,44 +300,6 @@ impl ArrowSession {
304300 }
305301 }
306302
307- /// Build the Arrow [`DataType`] for a Vortex [`DType`].
308- ///
309- /// Recurses into container types so nested extension fields go through registered
310- /// plugins; non-recursive, non-extension dtypes delegate to
311- /// [`DType::to_arrow_dtype`]. Note that a bare [`DataType`] cannot carry Arrow
312- /// extension metadata — for inference that needs `ARROW:extension:name` on the
313- /// outermost node, use [`Self::to_arrow_field`] instead.
314- pub fn to_arrow_data_type ( & self , dtype : & DType ) -> VortexResult < DataType > {
315- Ok ( match dtype {
316- DType :: Extension ( ext) => {
317- let mut data_type = None ;
318- for plugin in self . exporters_by_vortex ( & ext. id ( ) ) . iter ( ) {
319- if let Some ( field) = plugin. to_arrow_field ( "" , ext, self ) ? {
320- data_type = Some ( field. data_type ( ) . clone ( ) ) ;
321- break ;
322- }
323- }
324- match data_type {
325- Some ( dt) => dt,
326- None => to_data_type_naive ( dtype) ?,
327- }
328- }
329- DType :: List ( elem, _) => DataType :: List ( Arc :: new ( self . to_arrow_field ( "item" , elem) ?) ) ,
330- DType :: FixedSizeList ( elem, size, _) => {
331- DataType :: FixedSizeList ( Arc :: new ( self . to_arrow_field ( "item" , elem) ?) , * size as i32 )
332- }
333- DType :: Struct ( struct_dtype, _) => {
334- let mut fields = Vec :: with_capacity ( struct_dtype. names ( ) . len ( ) ) ;
335- for ( name, field_dtype) in struct_dtype. names ( ) . iter ( ) . zip ( struct_dtype. fields ( ) ) {
336- fields. push ( self . to_arrow_field ( name. as_ref ( ) , & field_dtype) ?) ;
337- }
338- DataType :: Struct ( fields. into ( ) )
339- }
340- // Fallback,
341- _ => to_data_type_naive ( dtype) ?,
342- } )
343- }
344-
345303 /// Build the Arrow [`Schema`] for a Vortex top-level [`DType::Struct`], dispatching
346304 /// extension fields through registered export plugins for inference. Nested
347305 /// extensions are preserved via [`Self::to_arrow_field`].
0 commit comments