andygrove commented on code in PR #383: URL: https://github.com/apache/datafusion-comet/pull/383#discussion_r1600729203
########## core/src/execution/datafusion/expressions/cast.rs: ########## @@ -635,6 +642,38 @@ impl Cast { Ok(cast_array) } + fn cast_string_to_date( + array: &ArrayRef, + to_type: &DataType, + eval_mode: EvalMode, + ) -> CometResult<ArrayRef> { + let string_array = array + .as_any() + .downcast_ref::<GenericStringArray<i32>>() + .expect("Expected a string array"); + + let cast_array: ArrayRef = match to_type { + DataType::Date32 => { + let len = string_array.len(); + let mut cast_array = PrimitiveArray::<Date32Type>::builder(len); + for i in 0..len { + if string_array.is_null(i) { + cast_array.append_null() + } else if let Ok(Some(cast_value)) = + date_parser(string_array.value(i), eval_mode) Review Comment: @vidyasankarv This is the fix you need to make your current test pass. The problem was that we were ignoring any error here when runnin in ANSI mode. ```suggestion } else if let Some(cast_value) = date_parser(string_array.value(i), eval_mode)? ``` -- 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