Skip to content

Closes #5332: ArkoudaArray arithmetic methods add, sub, mul - #5333

Merged
ajpotts merged 1 commit into
Bears-R-Us:mainfrom
ajpotts:5332_ArkoudaArray_arithmetic_methods_add_sub_mul
Jan 23, 2026
Merged

ajpotts merged 1 commit into
Bears-R-Us:mainfrom
ajpotts:5332_ArkoudaArray_arithmetic_methods_add_sub_mul

Conversation

@ajpotts

@ajpotts ajpotts commented Jan 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR enables native Python arithmetic operators (e.g. +, -, *, /) for Arkouda-backed pandas ExtensionArrays by integrating pandas’ OpsMixin into the shared base class. It also adds a focused test suite to ensure operator dispatch routes through pandas’ ExtensionArray arithmetic protocol rather than relying on direct _arith_method calls.

Key changes

  • Add OpsMixin to ArkoudaExtensionArray, enabling Python dunder operators (__add__, __sub__, etc.) for all Arkouda-backed ExtensionArrays.
  • Add a new test module (tests/pandas/extension/arithmetic_ops.py) that:
    • Verifies operator dunder methods exist on Arkouda ExtensionArrays
    • Exercises true Python operator dispatch (x + y, x + scalar, scalar + x)
    • Confirms correct result values and type stability
    • Covers common arithmetic operators and error paths (invalid types, length mismatch)

Why this matters

Previously, _arith_method worked when called directly, but expressions like x + y failed because the required dunder methods were not present on the ExtensionArray classes. Integrating OpsMixin aligns Arkouda’s pandas extensions with pandas’ expected arithmetic protocol and restores intuitive operator behavior for users.

Testing

  • New unit tests added under tests/pandas/extension/arithmetic_ops.py
  • Tests fail on main and pass with this change
  • No changes to existing tests or behavior outside arithmetic dispatch

Closes #5332: ArkoudaArray arithmetic methods add, sub, mul

@ajpotts
ajpotts force-pushed the 5332_ArkoudaArray_arithmetic_methods_add_sub_mul branch from 1c20966 to 0f8ca4a Compare January 22, 2026 23:52
@codecov

codecov Bot commented Jan 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@aa538f9). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #5333   +/-   ##
========================================
  Coverage        ?   100.00%           
========================================
  Files           ?         4           
  Lines           ?        63           
  Branches        ?         0           
========================================
  Hits            ?        63           
  Misses          ?         0           
  Partials        ?         0           
Flag Coverage Δ
python-coverage 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ajpotts
ajpotts marked this pull request as ready for review January 23, 2026 12:56
@ajpotts ajpotts added the blocking This is blocking a developer from completing a task they are actively working. label Jan 23, 2026

@drculhane drculhane left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also looks very straightforward. Nice work.

@1RyanK 1RyanK left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@ajpotts
ajpotts force-pushed the 5332_ArkoudaArray_arithmetic_methods_add_sub_mul branch from 0f8ca4a to 02cacd6 Compare January 23, 2026 16:32
@ajpotts
ajpotts force-pushed the 5332_ArkoudaArray_arithmetic_methods_add_sub_mul branch from 67b1bcf to 8daa894 Compare January 23, 2026 17:55
@ajpotts
ajpotts enabled auto-merge January 23, 2026 18:09

@jaketrookman jaketrookman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@ajpotts
ajpotts added this pull request to the merge queue Jan 23, 2026
Merged via the queue into Bears-R-Us:main with commit f7bef63 Jan 23, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocking This is blocking a developer from completing a task they are actively working.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ArkoudaArray arithmetic methods add, sub, mul

4 participants