jackylee-ch opened a new pull request, #12104:
URL: https://github.com/apache/gluten/pull/12104
## What changes are proposed in this pull request?
Building Arrow CPP on macOS with `-std=c++20` and Apple Clang's libc++
fails at the first translation unit that includes
`vendored/datetime/tz_private.h`:
```
cpp/src/arrow/vendored/datetime/tz.cpp:
error: use of overloaded operator '<<' is ambiguous
(with operand types 'std::ostream' and 'const date::sys_seconds')
```
Arrow 15.0.0 ships a vendored copy of Howard Hinnant's date library.
On macOS `-std=c++20`, libc++'s `std::chrono` exposes its own
`operator<<` for `sys_time` and related clock types that collides
with `date::operator<<` pulled in via `using namespace date;` /
`using date::operator<<;` inside `vendored/datetime/tz.cpp` and
`tz_private.h`.
Linux libstdc++ does not expose the conflicting `chrono::operator<<`,
so the build is unaffected there.
This PR adds `ep/build-velox/src/fix_vendored_datetime_operator.patch`
that replaces the ADL-driven `os << timepoint` call sites with an
explicit qualified call `date::operator<<(os, timepoint)` so the
vendored overload is selected unambiguously regardless of what
`std::chrono` provides. The patch is applied from
`dev/build-arrow.sh::prepare_arrow_build` after the existing Arrow
patches (`modify_arrow.patch`, `modify_arrow_dataset_scan_option.patch`,
`cmake-compatibility.patch`, `support_ibm_power.patch`).
Two callsites are touched, both inside Arrow's vendored date code:
| File | Function | Change |
|------|----------|--------|
| `cpp/src/arrow/vendored/datetime/tz.cpp:2734` | `operator<<(std::ostream&,
const leap_second&)` | drop `using namespace date;`, call `date::operator<<(os,
x.date_)` |
| `cpp/src/arrow/vendored/datetime/tz_private.h:291` |
`operator<<(std::ostream&, const transition&)` | drop `using
date::operator<<;`, call `date::operator<<(os, t.timepoint)` |
The patch is platform-agnostic: explicit qualification works on any
toolchain. Linux builds (which currently succeed) are unaffected
because the rewritten call resolves to the same overload they
previously selected via ADL.
## How was this patch tested?
- macOS 14 arm64 with Apple Clang 17 (`-std=c++20`): Arrow CPP build
reaches successful link of `libarrow.a`, `libarrow_cdata_jni.dylib`,
`libarrow_dataset_jni.dylib`. Before the patch, the build aborted at
the first TU including `tz_private.h` with the ambiguity error
shown above.
- macOS Spark 3.5 + Velox backend Java JNI canary suites
(VeloxBloomFilterTest, ColumnarBatchTest, VeloxListenerApiTest,
OnHeapFileSystemTest, ArrowColumnVectorTest) all pass on the
resulting build.
- Linux x86_64 Ubuntu 22.04 build green; the rewritten call sites
resolve to the same `date::operator<<` overload as before. Local
Ubuntu build verified clean.
## Was this patch authored or co-authored using generative AI tooling?
co-auth: Claude (Sonnet/Opus) via Claude Code 1.x
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]