You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/04/06 18:51:18 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5896: fix: binaryExpr not supported for LargeUtf8

alamb commented on code in PR #5896:
URL: https://github.com/apache/arrow-datafusion/pull/5896#discussion_r1160145881


##########
datafusion/core/tests/sqllogictests/test_files/select.slt:
##########
@@ -230,3 +230,10 @@ select CASE
 END;
 ----
 2
+
+# like and ilike for LargeUtf8
+# issue: https://github.com/apache/arrow-datafusion/issues/5893
+query B
+select arrow_cast('foo', 'LargeUtf8') like '%foo%';

Review Comment:
   Another test that would be great to add would be to compare columns as well as constants (as that is the other binary expr codepath)
   
   Something like
   
   ```sql
   create table t as values 
     (arrow_cast('Foo', 'LargeUtf8') '%f'), 
     (arrow_cast('Bar', 'LargeUtf8') 'B%');
   
   select column1 like column2 from t;
   select column1 ilike column2 from t;
   select column1 not like column2 from t;
   select column1 not ilike column2 from t;
   ```



##########
datafusion/physical-expr/src/expressions/binary.rs:
##########
@@ -233,7 +233,9 @@ macro_rules! compute_utf8_op_scalar {
             .as_any()
             .downcast_ref::<$DT>()
             .expect("compute_op failed to downcast left side array");
-        if let ScalarValue::Utf8(Some(string_value)) = $RIGHT {
+        if let ScalarValue::Utf8(Some(string_value))
+        | ScalarValue::LargeUtf8(Some(string_value)) = $RIGHT
+        {

Review Comment:
   I definitely think we should add this -- it is required to evaluate the like expression with a scalar.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org