vidyasankarv commented on code in PR #383:
URL: https://github.com/apache/datafusion-comet/pull/383#discussion_r1600977960


##########
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:
   oh sorry my mistake missed checking here.
   handling all cases of return value of date_parser using matching clause now. 
   thank you @andygrove 



-- 
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

Reply via email to