@@ -79,40 +79,35 @@ impl Scalar {
79
79
None ,
80
80
) )
81
81
}
82
- Null ( data_type) => match data_type {
83
- DataType :: Primitive ( primitive) => match primitive {
84
- PrimitiveType :: Byte => Arc :: new ( Int8Array :: new_null ( num_rows) ) ,
85
- PrimitiveType :: Short => Arc :: new ( Int16Array :: new_null ( num_rows) ) ,
86
- PrimitiveType :: Integer => Arc :: new ( Int32Array :: new_null ( num_rows) ) ,
87
- PrimitiveType :: Long => Arc :: new ( Int64Array :: new_null ( num_rows) ) ,
88
- PrimitiveType :: Float => Arc :: new ( Float32Array :: new_null ( num_rows) ) ,
89
- PrimitiveType :: Double => Arc :: new ( Float64Array :: new_null ( num_rows) ) ,
90
- PrimitiveType :: String => Arc :: new ( StringArray :: new_null ( num_rows) ) ,
91
- PrimitiveType :: Boolean => Arc :: new ( BooleanArray :: new_null ( num_rows) ) ,
92
- PrimitiveType :: Timestamp => {
93
- Arc :: new ( TimestampMicrosecondArray :: new_null ( num_rows) . with_timezone ( "UTC" ) )
94
- }
95
- PrimitiveType :: TimestampNtz => {
96
- Arc :: new ( TimestampMicrosecondArray :: new_null ( num_rows) )
97
- }
98
- PrimitiveType :: Date => Arc :: new ( Date32Array :: new_null ( num_rows) ) ,
99
- PrimitiveType :: Binary => Arc :: new ( BinaryArray :: new_null ( num_rows) ) ,
100
- PrimitiveType :: Decimal ( precision, scale) => Arc :: new (
101
- Decimal128Array :: new_null ( num_rows)
102
- . with_precision_and_scale ( * precision, * scale as i8 ) ?,
103
- ) ,
104
- } ,
105
- DataType :: Struct ( t) => {
106
- let fields: Fields = t. fields ( ) . map ( ArrowField :: try_from) . try_collect ( ) ?;
107
- Arc :: new ( StructArray :: new_null ( fields, num_rows) )
108
- }
109
- DataType :: Array ( t) => {
110
- let field =
111
- ArrowField :: new ( LIST_ARRAY_ROOT , t. element_type ( ) . try_into ( ) ?, true ) ;
112
- Arc :: new ( ListArray :: new_null ( Arc :: new ( field) , num_rows) )
113
- }
114
- DataType :: Map { .. } => unimplemented ! ( ) ,
115
- } ,
82
+ Null ( DataType :: BYTE ) => Arc :: new ( Int8Array :: new_null ( num_rows) ) ,
83
+ Null ( DataType :: SHORT ) => Arc :: new ( Int16Array :: new_null ( num_rows) ) ,
84
+ Null ( DataType :: INTEGER ) => Arc :: new ( Int32Array :: new_null ( num_rows) ) ,
85
+ Null ( DataType :: LONG ) => Arc :: new ( Int64Array :: new_null ( num_rows) ) ,
86
+ Null ( DataType :: FLOAT ) => Arc :: new ( Float32Array :: new_null ( num_rows) ) ,
87
+ Null ( DataType :: DOUBLE ) => Arc :: new ( Float64Array :: new_null ( num_rows) ) ,
88
+ Null ( DataType :: STRING ) => Arc :: new ( StringArray :: new_null ( num_rows) ) ,
89
+ Null ( DataType :: BOOLEAN ) => Arc :: new ( BooleanArray :: new_null ( num_rows) ) ,
90
+ Null ( DataType :: TIMESTAMP ) => {
91
+ Arc :: new ( TimestampMicrosecondArray :: new_null ( num_rows) . with_timezone ( "UTC" ) )
92
+ }
93
+ Null ( DataType :: TIMESTAMP_NTZ ) => {
94
+ Arc :: new ( TimestampMicrosecondArray :: new_null ( num_rows) )
95
+ }
96
+ Null ( DataType :: DATE ) => Arc :: new ( Date32Array :: new_null ( num_rows) ) ,
97
+ Null ( DataType :: BINARY ) => Arc :: new ( BinaryArray :: new_null ( num_rows) ) ,
98
+ Null ( DataType :: Primitive ( PrimitiveType :: Decimal ( precision, scale) ) ) => Arc :: new (
99
+ Decimal128Array :: new_null ( num_rows)
100
+ . with_precision_and_scale ( * precision, * scale as i8 ) ?,
101
+ ) ,
102
+ Null ( DataType :: Struct ( t) ) => {
103
+ let fields: Fields = t. fields ( ) . map ( ArrowField :: try_from) . try_collect ( ) ?;
104
+ Arc :: new ( StructArray :: new_null ( fields, num_rows) )
105
+ }
106
+ Null ( DataType :: Array ( t) ) => {
107
+ let field = ArrowField :: new ( LIST_ARRAY_ROOT , t. element_type ( ) . try_into ( ) ?, true ) ;
108
+ Arc :: new ( ListArray :: new_null ( Arc :: new ( field) , num_rows) )
109
+ }
110
+ Null ( DataType :: Map { .. } ) => unimplemented ! ( ) ,
116
111
} ;
117
112
Ok ( arr)
118
113
}
0 commit comments