File tree Expand file tree Collapse file tree
spark/src/function/string Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ pub struct PartitionEvaluatorPrivateData {
8686}
8787
8888impl FFI_PartitionEvaluator {
89- unsafe fn inner_mut ( & mut self ) -> & mut Box < ( dyn PartitionEvaluator + ' static ) > {
89+ unsafe fn inner_mut ( & mut self ) -> & mut Box < dyn PartitionEvaluator + ' static > {
9090 let private_data = self . private_data as * mut PartitionEvaluatorPrivateData ;
9191 & mut ( * private_data) . evaluator
9292 }
Original file line number Diff line number Diff line change @@ -405,7 +405,7 @@ impl<T: DecimalType + ArrowNumericType + Debug> Accumulator for DecimalAvgAccumu
405405 self . count += ( values. len ( ) - values. null_count ( ) ) as u64 ;
406406
407407 if let Some ( x) = sum ( values) {
408- let v = self . sum . get_or_insert ( T :: Native :: default ( ) ) ;
408+ let v = self . sum . get_or_insert_with ( T :: Native :: default) ;
409409 self . sum = Some ( v. add_wrapping ( x) ) ;
410410 }
411411 Ok ( ( ) )
@@ -450,7 +450,7 @@ impl<T: DecimalType + ArrowNumericType + Debug> Accumulator for DecimalAvgAccumu
450450
451451 // sums are summed
452452 if let Some ( x) = sum ( states[ 1 ] . as_primitive :: < T > ( ) ) {
453- let v = self . sum . get_or_insert ( T :: Native :: default ( ) ) ;
453+ let v = self . sum . get_or_insert_with ( T :: Native :: default) ;
454454 self . sum = Some ( v. add_wrapping ( x) ) ;
455455 }
456456 Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -382,7 +382,7 @@ where
382382{
383383 fn update_batch ( & mut self , values : & [ ArrayRef ] ) -> Result < ( ) > {
384384 if let Some ( x) = arrow:: compute:: bit_or ( values[ 0 ] . as_primitive :: < T > ( ) ) {
385- let v = self . value . get_or_insert ( T :: Native :: usize_as ( 0 ) ) ;
385+ let v = self . value . get_or_insert_with ( || T :: Native :: usize_as ( 0 ) ) ;
386386 * v = * v | x;
387387 }
388388 Ok ( ( ) )
@@ -427,7 +427,7 @@ where
427427{
428428 fn update_batch ( & mut self , values : & [ ArrayRef ] ) -> Result < ( ) > {
429429 if let Some ( x) = arrow:: compute:: bit_xor ( values[ 0 ] . as_primitive :: < T > ( ) ) {
430- let v = self . value . get_or_insert ( T :: Native :: usize_as ( 0 ) ) ;
430+ let v = self . value . get_or_insert_with ( || T :: Native :: usize_as ( 0 ) ) ;
431431 * v = * v ^ x;
432432 }
433433 Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -314,7 +314,7 @@ impl<T: ArrowNumericType> Accumulator for SumAccumulator<T> {
314314 fn update_batch ( & mut self , values : & [ ArrayRef ] ) -> Result < ( ) > {
315315 let values = values[ 0 ] . as_primitive :: < T > ( ) ;
316316 if let Some ( x) = arrow:: compute:: sum ( values) {
317- let v = self . sum . get_or_insert ( T :: Native :: usize_as ( 0 ) ) ;
317+ let v = self . sum . get_or_insert_with ( || T :: Native :: usize_as ( 0 ) ) ;
318318 * v = v. add_wrapping ( x) ;
319319 }
320320 Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -356,7 +356,7 @@ impl DisplayAs for SortMergeJoinExec {
356356 "SortMergeJoin: join_type={:?}, on=[{}]{}" ,
357357 self . join_type,
358358 on,
359- self . filter. as_ref( ) . map_or ( "" . to_string( ) , |f| format!(
359+ self . filter. as_ref( ) . map_or_else ( || "" . to_string( ) , |f| format!(
360360 ", filter={}" ,
361361 f. expression( )
362362 ) )
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ impl DisplayAs for GlobalLimitExec {
105105 f,
106106 "GlobalLimitExec: skip={}, fetch={}" ,
107107 self . skip,
108- self . fetch. map_or ( "None" . to_string( ) , |x| x. to_string( ) )
108+ self . fetch. map_or_else ( || "None" . to_string( ) , |x| x. to_string( ) )
109109 )
110110 }
111111 DisplayFormatType :: TreeRender => {
Original file line number Diff line number Diff line change @@ -149,5 +149,5 @@ fn luhn_check_impl(input: &str) -> bool {
149149 alt = !alt;
150150 }
151151
152- digits_processed > 0 && sum % 10 == 0
152+ digits_processed > 0 && sum. is_multiple_of ( 10 )
153153}
You can’t perform that action at this time.
0 commit comments