omerhadari opened a new issue, #942:
URL: https://github.com/apache/iceberg-rust/issues/942
When running queries such as `SELECT * FROM table WHERE ts_col =
CAST('2024-01-01 00:12:34' AS TIMESTAMP)`, Datafusion converts the Cast
directly to a `TimestampNanosecond` type. This is not handled by the code in
[here](https://github.com/apache/iceberg-rust/blob/main/crates/integrations/datafusion/src/physical_plan/expr_to_predicate.rs).
Test for example that shows the issue:
```Rust
#[test]
fn test_comparison_with_nanos_work() {
let left = Expr::Column(Column::new_unqualified("ts"));
let right =
Expr::Literal(ScalarValue::TimestampNanosecond(Some(1000), None));
let op = Operator::GtEq;
let binary_expr = Expr::BinaryExpr(BinaryExpr::new(Box::new(left),
op, Box::new(right)));
let predicate =
convert_filters_to_predicate(&vec![binary_expr]).unwrap();
let expected_predicate =
Reference::new("ts").greater_than_or_equal_to(Datum::timestamp_nanos(1000));
assert_eq!(predicate, expected_predicate);
}
```
Note:
The correct type of Datum should be handled in
[values.rs](https://github.com/apache/iceberg-rust/blob/c754e27f752a9e2f86180a9b40f69a3d4ab2dae9/crates/iceberg/src/spec/values.rs#L1186),
otherwise the issue will manifest as a failure to cast timestamp to whatever
it's compared to.
--
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]