Commit 898d73d
Add missing aggregate functions (#1471)
* Add missing aggregate functions: grouping, percentile_cont, var_population
Expose upstream DataFusion aggregate functions that were not yet
available in the Python API. Closes #1454.
- grouping: returns grouping set membership indicator (rewritten by
the ResolveGroupingFunction analyzer rule before physical planning)
- percentile_cont: computes exact percentile using continuous
interpolation (unlike approx_percentile_cont which uses t-digest)
- var_population: alias for var_pop
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix grouping() distinct parameter type for API consistency
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Improve aggregate function tests and docstrings per review feedback
Add docstring example to grouping(), parametrize percentile_cont tests,
and add multi-column grouping test case.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add GroupingSet.rollup, .cube, and .grouping_sets factory methods
Expose ROLLUP, CUBE, and GROUPING SETS via the DataFrame API by adding
static methods on GroupingSet that construct the corresponding Expr
variants. Update grouping() docstring and tests to use the new API.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Remove _GroupingSetInternal alias, use expr_internal.GroupingSet directly
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Parametrize grouping set tests for rollup and cube
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add grouping sets documentation and note grouping() alias limitation
Add user documentation for GroupingSet.rollup, .cube, and
.grouping_sets with Pokemon dataset examples. Document the upstream
alias limitation (apache/datafusion#21411) in both the grouping()
docstring and the aggregation user guide.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add grouping sets note to DataFrame.aggregate() docstring
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Address PR review feedback: add quantile_cont alias and simplify examples
- Add quantile_cont as alias for percentile_cont (matches upstream)
- Replace pa.concat_arrays batch pattern with collect_column() in docstrings
- Add percentile_cont, quantile_cont, var_population to docs function list
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Accept string column names in GroupingSet factory methods
GroupingSet.rollup(), .cube(), and .grouping_sets() now accept both
Expr objects and string column names, consistent with DataFrame.aggregate().
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add agent instructions to keep aggregation/window docs in sync
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* dfn is already available globally
* Remove unnecessary import on doctest
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent d07fdb3 commit 898d73d
File tree
8 files changed
+614
-12
lines changed- crates/core/src
- expr
- docs/source/user-guide/common-operations
- python
- datafusion
- tests
8 files changed
+614
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
33 | 68 | | |
34 | 69 | | |
35 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
791 | 791 | | |
792 | 792 | | |
793 | 793 | | |
794 | | - | |
795 | | - | |
796 | | - | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
797 | 798 | | |
798 | 799 | | |
799 | 800 | | |
| |||
831 | 832 | | |
832 | 833 | | |
833 | 834 | | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
834 | 848 | | |
835 | 849 | | |
836 | 850 | | |
| |||
1031 | 1045 | | |
1032 | 1046 | | |
1033 | 1047 | | |
| 1048 | + | |
1034 | 1049 | | |
1035 | 1050 | | |
1036 | 1051 | | |
| |||
1080 | 1095 | | |
1081 | 1096 | | |
1082 | 1097 | | |
1083 | | - | |
| 1098 | + | |
1084 | 1099 | | |
1085 | 1100 | | |
1086 | 1101 | | |
| |||
Lines changed: 171 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
166 | 328 | | |
167 | 329 | | |
168 | 330 | | |
| |||
192 | 354 | | |
193 | 355 | | |
194 | 356 | | |
| 357 | + | |
195 | 358 | | |
196 | 359 | | |
197 | 360 | | |
| |||
208 | 371 | | |
209 | 372 | | |
210 | 373 | | |
211 | | - | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
212 | 377 | | |
213 | 378 | | |
214 | 379 | | |
215 | 380 | | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
216 | 386 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
633 | 633 | | |
634 | 634 | | |
635 | 635 | | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
636 | 647 | | |
637 | | - | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
638 | 652 | | |
639 | 653 | | |
640 | 654 | | |
| |||
0 commit comments