liukun4515 commented on code in PR #4741:
URL: https://github.com/apache/arrow-datafusion/pull/4741#discussion_r1058277985
##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -575,6 +575,7 @@ fn temporal_coercion(lhs_type: &DataType, rhs_type:
&DataType) -> Option<DataTyp
},
(Timestamp(_, tz), Utf8) => Some(Timestamp(TimeUnit::Nanosecond,
tz.clone())),
(Utf8, Timestamp(_, tz)) => Some(Timestamp(TimeUnit::Nanosecond,
tz.clone())),
+ // TODO: need to investigate the result type for the comparison
between timestamp and date
Review Comment:
I try the comparison timestamp with date in the Spark, and find the coerced
type is timestamp.
```
spark-sql> explain extended select now()>cast('2000-01-01' as date);
== Parsed Logical Plan ==
'Project [unresolvedalias(('now() > cast(2000-01-01 as date)), None)]
+- OneRowRelation
== Analyzed Logical Plan ==
(now() > CAST(2000-01-01 AS DATE)): boolean
Project [(now() > cast(cast(2000-01-01 as date) as timestamp)) AS (now() >
CAST(2000-01-01 AS DATE))#49]
+- OneRowRelation
== Optimized Logical Plan ==
Project [true AS (now() > CAST(2000-01-01 AS DATE))#49]
+- OneRowRelation
== Physical Plan ==
*(1) Project [true AS (now() > CAST(2000-01-01 AS DATE))#49]
+- *(1) Scan OneRowRelation[]
```
cc @comphead @alamb
But current implementation of coerced type is date, we can fix this in the
follow up PR.
--
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]