comphead commented on code in PR #5014:
URL: https://github.com/apache/datafusion-comet/pull/5014#discussion_r3646339447


##########
native/spark-expr/src/conversion_funcs/string.rs:
##########
@@ -2798,6 +2809,25 @@ mod tests {
         );
     }
 
+    /// Malformed input: null in legacy and try mode, CAST_INVALID_INPUT in 
ANSI mode.

Review Comment:
   ```
   fn assert_dates(
       dates: &[&str],
       modes: &[EvalMode],
       expect_ansi_error: bool,
   ) {
       for &date in dates {
           for &mode in modes {
               if expect_ansi_error && mode == EvalMode::Ansi {
                   assert!(date_parser(date, mode).is_err(), "{date}");
               } else {
                   assert_eq!(date_parser(date, mode).unwrap(), None, "{date}");
               }
           }
       }
   }
   
   /// Malformed input: null in legacy and try mode, CAST_INVALID_INPUT in ANSI 
mode.
   fn assert_null_or_ansi_error(dates: &[&str]) {
       assert_dates(
           dates,
           &[EvalMode::Legacy, EvalMode::Try, EvalMode::Ansi],
           true,
       );
   }
   
   /// Input Spark parses successfully but Comet cannot represent: null in 
every eval mode.
   fn assert_null_in_all_modes(dates: &[&str]) {
       assert_dates(
           dates,
           &[EvalMode::Legacy, EvalMode::Try, EvalMode::Ansi],
           false,
       );
   }
   ```
   
   to remove some duplication



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to