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

[GitHub] [arrow-datafusion] izveigor opened a new pull request, #6618: feat: `array_contains`

izveigor opened a new pull request, #6618:
URL: https://github.com/apache/arrow-datafusion/pull/6618

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes https://github.com/apache/arrow-datafusion/issues/6557
   
   # Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   # What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are these changes tested?
   Yes
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   # Are there any user-facing changes?
   Yes
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->


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


[GitHub] [arrow-datafusion] izveigor commented on a diff in pull request #6618: feat: `array_contains`

Posted by "izveigor (via GitHub)" <gi...@apache.org>.
izveigor commented on code in PR #6618:
URL: https://github.com/apache/arrow-datafusion/pull/6618#discussion_r1240200411


##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -1070,6 +1071,70 @@ pub fn array_ndims(args: &[ColumnarValue]) -> Result<ColumnarValue> {
     ]))))
 }
 
+macro_rules! contains {

Review Comment:
   What the function: https://docs.rs/arrow/latest/arrow/compute/kernels/comparison/fn.in_list.html?



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


[GitHub] [arrow-datafusion] alamb commented on pull request #6618: feat: `array_contains`

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6618:
URL: https://github.com/apache/arrow-datafusion/pull/6618#issuecomment-1608257318

   > @alamb I think it would be better to create a separate array function ticket with columns (Since I considered only scalars as arguments). (See the tickets: https://github.com/apache/arrow-datafusion/issues/6693 and https://github.com/apache/arrow-datafusion/issues/6709).
   
   Indeed @izveigor  -- in fact I found exactly the same bug when writing the tests --  https://github.com/apache/arrow-datafusion/pull/6771


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


[GitHub] [arrow-datafusion] alamb merged pull request #6618: feat: `array_contains`

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #6618:
URL: https://github.com/apache/arrow-datafusion/pull/6618


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


[GitHub] [arrow-datafusion] izveigor commented on pull request #6618: feat: `array_contains`

Posted by "izveigor (via GitHub)" <gi...@apache.org>.
izveigor commented on PR #6618:
URL: https://github.com/apache/arrow-datafusion/pull/6618#issuecomment-1608229184

   @alamb I think it would be better to create a separate array function ticket with columns (Since I considered only scalars as arguments). (See the tickets: https://github.com/apache/arrow-datafusion/issues/6693 and https://github.com/apache/arrow-datafusion/issues/6709).


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


[GitHub] [arrow-datafusion] izveigor commented on pull request #6618: feat: `array_contains`

Posted by "izveigor (via GitHub)" <gi...@apache.org>.
izveigor commented on PR #6618:
URL: https://github.com/apache/arrow-datafusion/pull/6618#issuecomment-1604734932

   @alamb I wonder if you review this PR if you have free time.


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


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #6618: feat: `array_contains`

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6618:
URL: https://github.com/apache/arrow-datafusion/pull/6618#discussion_r1242735645


##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -1070,6 +1071,70 @@ pub fn array_ndims(args: &[ColumnarValue]) -> Result<ColumnarValue> {
     ]))))
 }
 
+macro_rules! contains {

Review Comment:
   I don't quite understand this comment -- are you saying that it would be better to use the `in_list` kernel  rather than flattening it?



##########
docs/source/user-guide/expressions.md:
##########
@@ -179,23 +179,24 @@ Unlike to some databases the math functions in Datafusion works the same way as
 
 ## Array Expressions

Review Comment:
   ❤️ 



##########
docs/source/user-guide/sql/scalar_functions.md:
##########
@@ -1424,6 +1425,21 @@ array_concat(array[, ..., array_n])
   Can be a constant, column, or function, and any combination of array operators.
 - **array_n**: Subsequent array column or literal array to concatenate.
 
+### `array_contains`
+
+Returns true, if each element of the second array appearing in the first array, otherwise false.

Review Comment:
   ```suggestion
   Returns true, if each element of the second array appears in the first array, otherwise false.
   ```



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


[GitHub] [arrow-datafusion] alamb commented on pull request #6618: feat: `array_contains`

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6618:
URL: https://github.com/apache/arrow-datafusion/pull/6618#issuecomment-1605381050

   I will find time to review this PR, but maybe not until Monday


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


[GitHub] [arrow-datafusion] alamb commented on pull request #6618: feat: `array_contains`

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6618:
URL: https://github.com/apache/arrow-datafusion/pull/6618#issuecomment-1610035157

   Thanks again @izveigor 


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


[GitHub] [arrow-datafusion] alamb commented on pull request #6618: feat: `array_contains`

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6618:
URL: https://github.com/apache/arrow-datafusion/pull/6618#issuecomment-1608210809

   The other thing I think would help this PR is some tests for the array version in `.slt` (rather than just scalar) but I will write those as a follow on PR (as I want to get some experience with these functions myself). 


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