Hi,
This is likely a question (or two) with a simple answer that I couldn't easily
find. While working with PyArrow UDFs, I tried implementing a simple UDF (see
first function below) and noticed that it failed upon receiving a
pyarrow.lib.DoubleArray which cannot be directly manipulated with arithmetic
operations like multiplication by an int. I was able to get around it by
converting to pandas, manipulating, and converting back (see second function
below), but this seems awkward. What is the idiomatic way of performing
arithmetic operations on PyArrow numeric arrays? Does it make sense to add
arithmetic operation support to PyArrow numeric arrays?
def twice(v):
return v * 2 # fails with TypeError("unsupported operand type(s) for *:
'pyarrow.lib.DoubleArray' and 'int'")
def twice(v):
return pa.FloatingPointArray.from_pandas(v.to_pandas() * 2) # works but
seems awkward
Cheers,
Yaron.