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
contains
is backwards for what you're trying to do -- however,isin
isn'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_scalar
really does require the result to only be a single value. So I think perhaps you'll need an intermediate materialization if ajoin
isn't practical.It's a bit verbose, but you can evaluate the
tax.segment_id
as 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