andygrove commented on code in PR #383: URL: https://github.com/apache/datafusion-comet/pull/383#discussion_r1600866070
########## core/src/execution/datafusion/expressions/cast.rs: ########## @@ -1444,13 +1483,136 @@ fn parse_str_to_time_only_timestamp(value: &str) -> CometResult<Option<i64>> { Ok(Some(timestamp)) } +//a string to date parser - port of spark's SparkDateTimeUtils#stringToDate. +fn date_parser(date_str: &str, eval_mode: EvalMode) -> CometResult<Option<i32>> { + // local functions + fn get_trimmed_start(bytes: &[u8]) -> usize { Review Comment: My understanding is that this is a direct port of Spark's logic. Spark skips characters rather than calling trim because it is more efficient (avoids extra memory allocation). It is possible that the code could be optimized more to take advantage of zero-cost abstractions in Rust, but I think we should look at optimizations as a follow up if we determine that performance needs improving. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org