Commit d06e4fa
[SPARK-59134][PS] Use native Spark function for NumPy frexp
### What changes were proposed in this pull request?
Implements `np.frexp` for pandas-on-Spark with native Spark expressions, replacing its `NotImplemented` placeholder. It reuses the two-output ufunc support added for `np.modf` (SPARK-58790), so `mantissa, exponent = np.frexp(psser)` works on Series, Index and DataFrame.
### Why are the changes needed?
`np.frexp` on a pandas-on-Spark object raises today, while pandas returns a `(mantissa, exponent)` pair, so the two APIs diverge here. Supporting it natively continues the NumPy coverage work under SPARK-58532.
### Does this PR introduce _any_ user-facing change?
Yes. `np.frexp` on a pandas-on-Spark Series, Index or DataFrame returns a `(mantissa, exponent)` tuple instead of raising.
### How was this patch tested?
New `test_np_frexp` in `NumPyCompatTestsMixin` (classic and Connect parity), which fails without the change; the outputs were also checked bit-exact against NumPy with a probe covering every power of two ±1 ulp and both ends of the double range.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5)
Closes #58434 from Spenserrrr/numpy-frexp-two-output.
Authored-by: Spenser Sun <hsun112358@gmail.com>
Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>1 parent 37bca2c commit d06e4fa
2 files changed
Lines changed: 126 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | 54 | | |
57 | 55 | | |
58 | 56 | | |
| |||
291 | 289 | | |
292 | 290 | | |
293 | 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 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
294 | 349 | | |
295 | 350 | | |
296 | 351 | | |
297 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
298 | 356 | | |
299 | 357 | | |
300 | 358 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
390 | 389 | | |
391 | 390 | | |
392 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
393 | 458 | | |
394 | 459 | | |
395 | 460 | | |
| |||
0 commit comments