alamb commented on code in PR #22759:
URL: https://github.com/apache/datafusion/pull/22759#discussion_r3364674697


##########
datafusion/expr-common/src/type_coercion/binary.rs:
##########
@@ -2048,22 +2048,10 @@ fn temporal_coercion(lhs_type: &DataType, rhs_type: 
&DataType) -> Option<DataTyp
 fn timeunit_coercion(lhs_unit: &TimeUnit, rhs_unit: &TimeUnit) -> TimeUnit {
     use arrow::datatypes::TimeUnit::*;
     match (lhs_unit, rhs_unit) {
-        (Second, Millisecond) => Second,

Review Comment:
   here is an example where the old code would lose data (it would convert 
millisecond precision to second precision)



##########
datafusion/common/src/scalar/mod.rs:
##########
@@ -4287,10 +4312,14 @@ impl ScalarValue {
         ScalarValue::try_from_array(&cast_arr, 0)
     }
 
-    fn date_scalar_value_as_i64(&self) -> Option<i64> {
+    fn temporal_scalar_value_as_i64(&self) -> Option<i64> {

Review Comment:
   It might make sense to keep treating date and timestamp separately for 
consistency with the rest of the code. For example keep 
`date_scalar_value_as_i64` and add `timestamp_scalar_value_as_i64`
   
   But this looks fine too



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to