Repository navigation
[Datasets] Multi-aggregations [2/3]: Add groupby multi-column/multi-lambda aggregation - #20074
Conversation
20ac5d8 to
a392f06
Compare
a392f06 to
db5129a
Compare
There was a problem hiding this comment.
A happy accident of adding a __len__() definition to ArrowRow is that consuming rows from a NumPy Dataset now transparently removes the single-column table nesting.
8cee895 to
fac8259
Compare
| print(f"Seeding RNG for test_groupby_arrow_multicolumn with: {seed}") | ||
| random.seed(seed) | ||
| xs = list(range(100)) | ||
| random.shuffle(xs) |
There was a problem hiding this comment.
For bonus randomness I'd also .repartition(random(0, 100)) to induce random partitioning.
There was a problem hiding this comment.
Otherwise every partition would have 1 element only.
There was a problem hiding this comment.
I opted to go with a [1, 10, 100] partitioning set, I think this should give us the best tradeoff of partitioning edge case coverage with test time.
…egations for a multi-column aggregation into a utility, shared by both Dataset and GroupedDataset.
…repartitioning." This reverts commit 99438ab.
ericl
left a comment
There was a problem hiding this comment.
I think the empty block handling shouldn't be done in repartition.
79a068f to
8399bd1
Compare
8399bd1 to
9c467c1
Compare
|
@ericl Could you take another pass? |
|
Datasets tests passed and other Python failures are unrelated, I think this is ready to merge cc @ericl |
As a stacked follow-up to #20044 (only the last commit contains incremental changes from original PR), this PR adds multi-column/multi-lambda aggregations, making it much easier to express "do some aggregation on multiple columns".
Mean on 3 columns - old API
Mean on 3 columns - new API
This PR also adds thorough checking of the
onaggregation argument.Drivebys
.repartition()wasn't properly handling thenum_partitions > num_rowscase: for a simpleDatasetwith simple blocks, the generated empty blocks were Arrow blocks instead of simple blocks, which causes most downstream operations to break. We explicitly handle the empty block case in.repartition(). We should find a way to fix this in general, so I opened an issue for that effort.Checks
scripts/format.shto lint the changes in this PR.