@@ -234,36 +234,6 @@ fn if_then_else(
234234 }
235235}
236236
237- macro_rules! make_null_array {
238- ( $TY: ty, $N: expr) => { {
239- let mut builder = <$TY>:: new( $N) ;
240- for _ in 0 ..$N {
241- builder. append_null( ) ?;
242- }
243- Ok ( Arc :: new( builder. finish( ) ) )
244- } } ;
245- }
246-
247- fn build_null_array ( data_type : & DataType , num_rows : usize ) -> Result < ArrayRef > {
248- match data_type {
249- DataType :: UInt8 => make_null_array ! ( array:: UInt8Builder , num_rows) ,
250- DataType :: UInt16 => make_null_array ! ( array:: UInt16Builder , num_rows) ,
251- DataType :: UInt32 => make_null_array ! ( array:: UInt32Builder , num_rows) ,
252- DataType :: UInt64 => make_null_array ! ( array:: UInt64Builder , num_rows) ,
253- DataType :: Int8 => make_null_array ! ( array:: Int8Builder , num_rows) ,
254- DataType :: Int16 => make_null_array ! ( array:: Int16Builder , num_rows) ,
255- DataType :: Int32 => make_null_array ! ( array:: Int32Builder , num_rows) ,
256- DataType :: Int64 => make_null_array ! ( array:: Int64Builder , num_rows) ,
257- DataType :: Float32 => make_null_array ! ( array:: Float32Builder , num_rows) ,
258- DataType :: Float64 => make_null_array ! ( array:: Float64Builder , num_rows) ,
259- DataType :: Utf8 => make_null_array ! ( array:: StringBuilder , num_rows) ,
260- other => Err ( DataFusionError :: Execution ( format ! (
261- "CASE does not support '{:?}'" ,
262- other
263- ) ) ) ,
264- }
265- }
266-
267237macro_rules! array_equals {
268238 ( $TY: ty, $L: expr, $R: expr, $eq_fn: expr) => { {
269239 let when_value = $L
@@ -347,7 +317,7 @@ impl CaseExpr {
347317 let mut current_value: Option < ArrayRef > = if let Some ( e) = & self . else_expr {
348318 Some ( e. evaluate ( batch) ?. into_array ( batch. num_rows ( ) ) )
349319 } else {
350- Some ( build_null_array ( & return_type, batch. num_rows ( ) ) ? )
320+ Some ( new_null_array ( & return_type, batch. num_rows ( ) ) )
351321 } ;
352322
353323 // walk backwards through the when/then expressions
@@ -388,7 +358,7 @@ impl CaseExpr {
388358 let mut current_value: Option < ArrayRef > = if let Some ( e) = & self . else_expr {
389359 Some ( e. evaluate ( batch) ?. into_array ( batch. num_rows ( ) ) )
390360 } else {
391- Some ( build_null_array ( & return_type, batch. num_rows ( ) ) ? )
361+ Some ( new_null_array ( & return_type, batch. num_rows ( ) ) )
392362 } ;
393363
394364 // walk backwards through the when/then expressions
0 commit comments