alamb commented on code in PR #22562:
URL: https://github.com/apache/datafusion/pull/22562#discussion_r3312274584
##########
datafusion/core/tests/parquet/row_group_pruning.rs:
##########
@@ -2078,3 +2078,26 @@ async fn test_limit_pruning_exceeds_fully_matched() ->
datafusion_common::error:
.await;
Ok(())
}
+
+#[tokio::test]
+async fn prune_like_prefix() {
Review Comment:
I verified that this test fails like this without the code chnage
```
thread 'parquet::row_group_pruning::prune_like_prefix' (83571793) panicked
at datafusion/core/tests/parquet/row_group_pruning.rs:138:9:
assertion `left == right` failed: mismatched predicate_evaluation error
left: Some(5)
right: Some(0)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
##########
datafusion/pruning/src/pruning_predicate.rs:
##########
@@ -1816,6 +1817,13 @@ fn extract_string_literal(expr: &Arc<dyn PhysicalExpr>)
-> Option<&str> {
None
}
+/// Wrap a string in a `Literal` whose `ScalarValue` matches `target_type`
+fn string_literal_as(value: String, target_type: &DataType) -> Arc<dyn
PhysicalExpr> {
+ let utf8 = ScalarValue::Utf8(Some(value));
+ let scalar = try_cast_literal_to_type(&utf8, target_type).unwrap_or(utf8);
Review Comment:
👍
It is sad that this potentially results in a new allocation -- maybe as a
follow on PR we can avoid the allocation in `try_cast_literal_to_type`
--
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]