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


##########
crates/iceberg/src/spec/values.rs:
##########
@@ -1196,14 +1199,92 @@ impl Datum {
                     (PrimitiveLiteral::Int(val), _, PrimitiveType::Int) => 
Ok(Datum::int(*val)),
                     (PrimitiveLiteral::Int(val), _, PrimitiveType::Date) => 
Ok(Datum::date(*val)),
                     (PrimitiveLiteral::Int(val), _, PrimitiveType::Long) => 
Ok(Datum::long(*val)),
+                    (PrimitiveLiteral::Int(val), PrimitiveType::Date, 
PrimitiveType::Timestamp) => {
+                        Ok(Datum::timestamp_micros(*val as i64 * 
MICROS_PER_DAY))
+                    }
+                    (
+                        PrimitiveLiteral::Int(val),
+                        PrimitiveType::Date,
+                        PrimitiveType::Timestamptz,
+                    ) => Ok(Datum::timestamptz_micros(*val as i64 * 
MICROS_PER_DAY)),
+                    (
+                        PrimitiveLiteral::Int(val),
+                        PrimitiveType::Date,
+                        PrimitiveType::TimestampNs,
+                    ) => Ok(Datum::timestamp_nanos(
+                        *val as i64 * MICROS_PER_DAY * NANOS_PER_MICRO,

Review Comment:
   nit: Do a safe multiply here? (probably less more critical then above 
because the range is smaller).



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