Closes #5232: _reduce improvements for ArkoudaExtensionArray #5239
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Expand ArkoudaArray._reduce to support full reduction set
Summary
This PR significantly expands the internal
ArkoudaArray._reduceimplementation to support a broad, pandas-compatible set of reduction operations, and adds comprehensive tests covering both functionality and argument handling.The new implementation replaces a hard-coded conditional chain with a centralized, extensible dispatch table and introduces robust argument passthrough logic that safely forwards only supported keyword arguments to backend methods.
Key Changes
ArkoudaArray._reduce
strorGroupByReductionTypeskipna,ddof, etc.) based on backend method signaturesParameters,Returns,Raises)Supported reductions include:
all,any,sum,prod,min,max,mean,var,std,count,nunique,firstargmin,argmaxmedian,mode,unique,or,and,xorReductions not implemented by the underlying Arkouda backend raise a clear
TypeError.Test Coverage
The test suite for
ArkoudaArrayreductions has been substantially expanded:argmin/argmaxsemanticsuniqueandmodeor,and,xorfor boolean arraysskipnapassthrough behaviorddofpassthrough forvar/stdwhen supportedTests automatically
xfailwhen a reduction is not implemented by the current Arkouda backend, ensuring CI stability while preserving visibility into planned functionality.Motivation
This change moves
_reducecloser to pandasExtensionArrayexpectations, reduces duplication, and provides a clear framework for incrementally adding backend support for additional reductions.It also improves developer ergonomics by making reduction support explicit, discoverable, and well-tested.
Closes #5232: _reduce improvements for ArkoudaExtensionArray