jayzhan211 commented on code in PR #14812:
URL: https://github.com/apache/datafusion/pull/14812#discussion_r1969207266
##########
datafusion/sqllogictest/test_files/parquet.slt:
##########
@@ -619,13 +619,13 @@ query TT
explain select * from foo where starts_with(column1, 'f');
----
logical_plan
-01)Filter: foo.column1 LIKE Utf8View("f%")
-02)--TableScan: foo projection=[column1], partial_filters=[foo.column1 LIKE
Utf8View("f%")]
+01)Filter: CAST(foo.column1 AS Utf8) LIKE Utf8("f%")
Review Comment:
In this case, casting array is less efficient, since you only has 2
characters "f%" on right hand side.
Even more, instead of calling `make_scalar_function`, we can wrap scalar
case to arrow::Scalar and call
`arrow::compute::kernels::comparison::starts_with` directly.
It accepts Datum
```rust
pub fn starts_with(left: &dyn Datum, right: &dyn Datum) ->
Result<BooleanArray, ArrowError> {
like_op(Op::StartsWith, left, right)
}
```
--
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]