frisbeeman commented on code in PR #1569:
URL: https://github.com/apache/iceberg-rust/pull/1569#discussion_r2650965002


##########
crates/integrations/datafusion/src/physical_plan/expr_to_predicate.rs:
##########
@@ -214,18 +217,42 @@ fn scalar_value_to_datum(value: &ScalarValue) -> 
Option<Datum> {
         ScalarValue::LargeUtf8(Some(v)) => Some(Datum::string(v.clone())),
         ScalarValue::Date32(Some(v)) => Some(Datum::date(*v)),
         ScalarValue::Date64(Some(v)) => Some(Datum::date((*v / MILLIS_PER_DAY) 
as i32)),
+        ScalarValue::TimestampSecond(Some(v), tz) => {
+            interpret_timestamptz_micros(v.checked_mul(MICROS_PER_SECOND)?, 
tz.as_deref())
+        }
+        ScalarValue::TimestampMillisecond(Some(v), tz) => {
+            
interpret_timestamptz_micros(v.checked_mul(MICROS_PER_MILLISECOND)?, 
tz.as_deref())
+        }
+        ScalarValue::TimestampMicrosecond(Some(v), tz) => {
+            interpret_timestamptz_micros(*v, tz.as_deref())
+        }
+        ScalarValue::TimestampNanosecond(Some(v), Some(_)) => 
Some(Datum::timestamptz_nanos(*v)),

Review Comment:
   I found this test case 
https://github.com/apache/datafusion/blob/83ed19235b700a2bd41283301cfd344cb5b565bc/datafusion/sql/src/unparser/expr.rs#L3265-L3270
   ```
     (
         Arc::clone(&default_dialect),
         ScalarValue::TimestampMillisecond(
             Some(1757934000123),
             Some("+01:00".into()),
         ),
         "CAST('2025-09-15 12:00:00.123 +01:00' AS TIMESTAMP)",
     ),
   ```
   
   Based on this data `v` contains a value for UTC and `tz` can be safely 
omitted.



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