Tangruilin commented on code in PR #9019:
URL: https://github.com/apache/arrow-datafusion/pull/9019#discussion_r1472755435
##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -396,6 +396,39 @@ fn string_to_timestamp_nanos_shim(s: &str) -> Result<i64> {
string_to_timestamp_nanos(s).map_err(|e| e.into())
}
+fn to_date_impl(args: &[ColumnarValue], name: &str) -> Result<ColumnarValue> {
+ match args.len() {
+ 1 => handle::<Date32Type, _, Date32Type>(
+ args,
+ |s| {
+ string_to_timestamp_nanos_shim(s)
+ .map(|n| n / (1_000_000 * 24 * 60 * 60 * 1_000))
+ .and_then(|v| {
+ v.try_into().map_err(|_| {
+ internal_datafusion_err!("Unable to cast to Date32
for converting from i64 to i32 failed")
+ })
+ })
+ },
+ name,
+ ),
Review Comment:
We can not do that
for the reason the Date32 need i32 type and time_stamp need i64 type.
to_timestamp_impl did not deal with the converting from i64 to i32
--
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]