michaelbawuah commented on PR #53689:
URL: https://github.com/apache/arrow/pull/53689#issuecomment-6154945536
### Rationale for this change
Existing Arrow integer columns cannot directly be assembled into a
month-day-nanosecond interval array through the compute API. This adds the
constructor proposed in GH-34824, allowing callers to work with Arrow columns
and broadcast scalar components without assembling Python tuples.
### What changes are included in this PR?
- Add `month_day_nano_interval_from_parts(months, days, nanoseconds)` and the
C++ eager API `MonthDayNanoIntervalFromParts`.
- Accept integer and null inputs, with safe casts to int32 months/days and
int64 nanoseconds, standard scalar broadcasting and null intersection.
- Write interval components directly into the preallocated output buffer,
preserving the supplied values without normalization.
- Register the kernel, update CMake and Meson source lists, and document the
function in the C++ compute reference and Python API index.
- Add C++/Python contract tests and paired native-builder benchmarks.
### Are these changes tested?
The seven new C++ cases and 14 new Python cases pass. Coverage includes every
array/scalar combination, nulls, sliced validity offsets, empty/chunked
inputs,
dictionary inputs, integer limits, checked overflow, rejected types, invalid
arity/lengths, and the C++ eager API.
The full native temporal, compute-internals and cast selections report 242
passed and one existing locale-dependent skip. Related Python registry and
temporal tests report 25 passed and two optional-cloudpickle skips. The
Release
benchmark target builds and runs; it compares against a pre-reserved native
builder with five repeats across sizes, null densities, and broadcasting
modes.
### Are there any user-facing changes?
There is a new C++ eager API and automatically exposed Python compute
function:
```python
days = pa.array([1, 32, None], type=pa.int32())
pc.month_day_nano_interval_from_parts(0, days, 0)
# [(0, 1, 0), (0, 32, 0), None]
```
Integer components outside their physical widths raise an error. If any
component is null, the interval is null. Values such as 32 days are preserved
without being converted to months.
### Was AI used for this PR?
In accordance to the [AI generation
guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code),
please disclose below whether and how AI was used in this PR.
**PR code and description written by:**
- [ #] Human
- [ ] AI
**Reviewed before submission by:**
- [ #] Human
- [ ] AI
- [ ] Not reviewed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]