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

[C++][Python] Implement pc.equal for List arguments #45167

Open
WillAyd opened this issue Jan 4, 2025 · 1 comment
Open

[C++][Python] Implement pc.equal for List arguments #45167

WillAyd opened this issue Jan 4, 2025 · 1 comment

Comments

@WillAyd
Copy link
Contributor

WillAyd commented Jan 4, 2025

Describe the enhancement requested

The follow arguments to pc.equal raise

>>> import pyarrow as pa
>>> import pyarrow.compute as pc
>>> arr = pa.array([[1, 2, 3], None])
>>> pc.equal(arr, arr)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/willayd/miniforge3/envs/pandas-dev/lib/python3.10/site-packages/pyarrow/compute.py", line 247, in wrapper
    return func.call(args, None, memory_pool)
  File "pyarrow/_compute.pyx", line 393, in pyarrow._compute.Function.call
  File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
  File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
pyarrow.lib.ArrowNotImplementedError: Function 'equal' has no kernel matching input types (list<item: int64>, list<item: int64>)
>>> pc.equal(arr, pa.scalar([1, 2, 3]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/willayd/miniforge3/envs/pandas-dev/lib/python3.10/site-packages/pyarrow/compute.py", line 247, in wrapper
    return func.call(args, None, memory_pool)
  File "pyarrow/_compute.pyx", line 393, in pyarrow._compute.Function.call
  File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
  File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
pyarrow.lib.ArrowNotImplementedError: Function 'equal' has no kernel matching input types (list<item: int64>, list<item: int64>)

Although I think these should be supported

Component(s)

Python

@raulcd raulcd changed the title Implement pc.equal for List arguments [C++][Python] Implement pc.equal for List arguments Jan 7, 2025
@raulcd
Copy link
Member

raulcd commented Jan 10, 2025

It would be interesting to do the same for other nested types like structs too:

>>> ty = pa.struct([pa.field('a', pa.int8()), pa.field('b', pa.float32())])
>>> arr = pa.array([(1, 2.5), (3, 4.5), (5, 6.5)], type=ty)
>>> arr2 = pa.array([(1, 2.5), (3, 4.5), (5, 6.5)], type=ty)
>>> pc.equal(arr, arr2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/raulcd/code/arrow/python/pyarrow/compute.py", line 247, in wrapper
    return func.call(args, None, memory_pool)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pyarrow/_compute.pyx", line 393, in pyarrow._compute.Function.call
    result = GetResultValue(
  File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
    return check_status(status)
  File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
    raise convert_status(status)
pyarrow.lib.ArrowNotImplementedError: Function 'equal' has no kernel matching input types (struct<a: int8, b: float>, struct<a: int8, b: float>)
/home/raulcd/code/arrow/cpp/src/arrow/compute/function.cc:329  DispatchBest(&inputs)
/home/raulcd/code/arrow/cpp/src/arrow/compute/function.cc:341  func.GetBestExecutor(inputs)

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

No branches or pull requests

2 participants