[DF] Add median support for RDataFrame - #23079
Open
ArjunXvarma wants to merge 6 commits into
Open
Conversation
added 4 commits
August 17, 2026 15:39
Cover the Median action in the existing action-API tests for scalar and collection columns, and add dedicated cases for: - odd and even numbers of entries, with distinct middle values to check that the two central values are averaged - empty datasets for both scalar and collection columns, which return NaN - a skewed distribution in the multithreaded test fixture, verifying that per-slot buffers are merged correctly - cloning the action via MakeNew, checking that the original and the clone both produce the correct result within a single event loop Each case uses data where the mean and median differ, so a regression cannot pass by coincidence.
ArjunXvarma
marked this pull request as ready for review
August 17, 2026 16:42
ArjunXvarma
requested review from
guitargeek,
hageboeck and
vepadulano
as code owners
August 17, 2026 16:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This Pull request:
Changes or fixes:
Adds a
Medianaction to RDataFrame, computing the exact median of a column.Draft - implementation is working; Google Test coverage and doxygen documentation still to come.Implemented as a
MedianHelperinActionHelpers.hxxfollowing the structure ofMeanHelper:values are buffered per slot in
Exec(with anIsDataContaineroverload for collection columns),and
Finalizemerges the per-slot buffers and usesstd::nth_elementto select the middleelement. Even entry counts return the average of the two middle values.
Scope, per the discussion in the issue: exact mode only.
GetMergeableValueis not implemented,so distributed execution is not supported - a median cannot be merged from a summary the way
RMergeableMeanmerges(mean, count), so that deserves separate discussion. Memory cost isO(N) doubles, which is inherent to an exact result.
Manually verified so far via the templated and jitted C++ paths, from Python, on
RVeccolumns,and with implicit multithreading enabled.
Checklist:
This PR is part of #22794