filter values in an array based on whether they are in a column of another table #10380
Answered
by
gforsyth
dschneiderch
asked this question in
Q&A
-
|
how can I filter the segment_id array column I create in I tried using partial and passing in tax.segment_id but I get |
Beta Was this translation helpful? Give feedback.
Answered by
gforsyth
Oct 29, 2024
Replies: 1 comment 4 replies
-
|
I can get what I want with |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're right that
containsis backwards for what you're trying to do -- however,isinisn't an array-level method, it works on the column as a whole, so I don't think it's going to do what you want.And I realized that
as_scalarreally does require the result to only be a single value. So I think perhaps you'll need an intermediate materialization if ajoinisn't practical.It's a bit verbose, but you can evaluate the
tax.segment_idas pyarrow and then make it a list, and that can be passed inline tointersect-- the general condition here isfilter where arr1.intersect(arr2).length() > 0