1
1
//! Feather Reader and Writer
2
- //!
2
+ //!
3
3
//! **Feather can be considered as deprecated, and is not suitable for long term storage.
4
4
//! We only include its support temporarily until Arrow has more IO support.**
5
5
//!
@@ -74,9 +74,7 @@ fn get_data_type(dtype: fbs::Type) -> DataType {
74
74
fbs:: Type :: DOUBLE => DataType :: Float64 ,
75
75
fbs:: Type :: UTF8 => DataType :: Utf8 ,
76
76
fbs:: Type :: BINARY => DataType :: Utf8 ,
77
- fbs:: Type :: CATEGORY => {
78
- unimplemented ! ( "Reading CATEGORY type columns not implemented" )
79
- }
77
+ fbs:: Type :: CATEGORY => unimplemented ! ( "Reading CATEGORY type columns not implemented" ) ,
80
78
fbs:: Type :: TIMESTAMP | fbs:: Type :: DATE | fbs:: Type :: TIME => {
81
79
unimplemented ! ( "Reading date and time fields not implemented" )
82
80
}
@@ -105,9 +103,7 @@ fn get_fbs_type(dtype: DataType) -> fbs::Type {
105
103
Time32 ( _) | Time64 ( _) => TIME ,
106
104
Interval ( _) => unimplemented ! ( "Interval type not supported" ) ,
107
105
Utf8 => UTF8 ,
108
- List ( _) | Struct ( _) => {
109
- unimplemented ! ( "Lists and Structs types are not supported" )
110
- }
106
+ List ( _) | Struct ( _) => unimplemented ! ( "Lists and Structs types are not supported" ) ,
111
107
}
112
108
}
113
109
@@ -264,10 +260,8 @@ impl<R: Read + Seek> FeatherReader<R> {
264
260
let strings: Vec < String > = string_pos
265
261
. windows ( 2 )
266
262
. map ( |w| {
267
- String :: from_utf8 (
268
- buffer[ ( w[ 0 ] as usize ) ..( w[ 1 ] as usize ) ] . to_vec ( ) ,
269
- )
270
- . unwrap ( )
263
+ String :: from_utf8 ( buffer[ ( w[ 0 ] as usize ) ..( w[ 1 ] as usize ) ] . to_vec ( ) )
264
+ . unwrap ( )
271
265
} )
272
266
. collect ( ) ;
273
267
@@ -289,19 +283,15 @@ impl<R: Read + Seek> FeatherReader<R> {
289
283
let arr = builder. finish ( ) ;
290
284
arrays. push ( Arc :: new ( arr) ) ;
291
285
292
- let field = Field :: new (
293
- name,
294
- get_data_type ( array. type_ ( ) ) ,
295
- array. null_count ( ) > 0 ,
296
- ) ;
286
+ let field =
287
+ Field :: new ( name, get_data_type ( array. type_ ( ) ) , array. null_count ( ) > 0 ) ;
297
288
fields. push ( field) ;
298
289
}
299
290
fbs:: TypeMetadata :: TimestampMetadata
300
291
| fbs:: TypeMetadata :: DateMetadata
301
292
| fbs:: TypeMetadata :: TimeMetadata => {
302
293
return Err ( ArrowError :: IoError (
303
- "Date/time Feather records are currently not supported."
304
- . to_string ( ) ,
294
+ "Date/time Feather records are currently not supported." . to_string ( ) ,
305
295
) ) ;
306
296
}
307
297
fbs:: TypeMetadata :: NONE => {
@@ -323,8 +313,7 @@ impl<R: Read + Seek> FeatherReader<R> {
323
313
assert ! ( last_offset > 0 ) ;
324
314
325
315
// create field
326
- let field =
327
- Field :: new ( name, get_data_type ( array. type_ ( ) ) , null_count > 0 ) ;
316
+ let field = Field :: new ( name, get_data_type ( array. type_ ( ) ) , null_count > 0 ) ;
328
317
fields. push ( field) ;
329
318
330
319
let array_ref = if & dtype == & DataType :: Utf8 {
@@ -548,14 +537,12 @@ impl FeatherWriter for RecordBatch {
548
537
}
549
538
DataType :: Float16 => {
550
539
return Err ( ArrowError :: IoError (
551
- "DataType::Float16 is currently not supported by Rust Arrow"
552
- . to_string ( ) ,
540
+ "DataType::Float16 is currently not supported by Rust Arrow" . to_string ( ) ,
553
541
) ) ;
554
542
}
555
543
DataType :: List ( _) | DataType :: Struct ( _) => {
556
544
return Err ( ArrowError :: IoError (
557
- "Writing of lists and structs not supported in Feather"
558
- . to_string ( ) ,
545
+ "Writing of lists and structs not supported in Feather" . to_string ( ) ,
559
546
) ) ;
560
547
}
561
548
DataType :: Timestamp ( _)
@@ -564,8 +551,7 @@ impl FeatherWriter for RecordBatch {
564
551
| DataType :: Time64 ( _)
565
552
| DataType :: Interval ( _) => {
566
553
return Err ( ArrowError :: IoError (
567
- "Date and time formats currently not supported by Rust Arrow"
568
- . to_string ( ) ,
554
+ "Date and time formats currently not supported by Rust Arrow" . to_string ( ) ,
569
555
) ) ;
570
556
}
571
557
}
0 commit comments