Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function .isin() rasie Exception: pyarrow.lib import ArrowInvalid: Cannot append scalar of type string to builder for type large_string #2444

Open
myloe00 opened this issue Oct 31, 2024 · 1 comment

Comments

@myloe00
Copy link

myloe00 commented Oct 31, 2024

I found out by debugging that while vaex.expression.Expression.to_arrow return a dataset more than one chunk,
like this:

<pyarrow.lib.ChunkedArray object at 0x000002109B68A270>
[
  [
    "B-XXXXX",
   ],
   [ 
     "C1-XXXXX"
   ]
]

this exception will be raised.
So I try to change function vaex.expression.Expression.__arrow_array__ to

def __arrow_array__(self, type=None):
    values = self.to_arrow()
    try:
        res = pa.array(values, type=type)
    except ArrowInvalid as e:
        values = values.combine_chunks()
        res = pa.array(values, type=type)
    return res

And the exception resolved.

So, can i do it like this . Or other method to resovle this problem?

@ddelange
Copy link
Contributor

hi @myloe00 👋

please fill out the bug template including a minimal reproducible example and a full stack trace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants