Skip to content

DX-128331: Gandiva: normalize Darwin host triple to macosx so exp10 libcall is available (#151) to dremio_27.0_26_20 - #157

Merged
lriggs merged 1 commit into
dremio:dremio_27.0_26_20from
victor6567758:DX-128331-gandiva-fexp10-crash-dremio_27.0_26_20
Nov 12, 2026
Merged

lriggs merged 1 commit into
dremio:dremio_27.0_26_20from
victor6567758:DX-128331-gandiva-fexp10-crash-dremio_27.0_26_20

Conversation

@victor6567758

@victor6567758 victor6567758 commented Nov 11, 2026 •

Copy link
Copy Markdown

SUMMARY

Backport of #151 (merged into dremio_27.0_23_19 as 148cb4846c) to dremio_27.0_26_20, applied with git cherry-pick -x.

On macOS, Gandiva built its JIT target machine from LLVM's default host triple, whose OS is darwin<kernel version>. LLVM only enables macOS libcalls such as __exp10 for the macosx OS name. With IR optimization off, round(double, scale) for scales outside the lookup table lowers to llvm.exp10, which
fails with no libcall available for fexp10 and kills the JVM. The fix adds NormalizeDarwinTriple(), which rewrites a Darwin triple to macosx<version> (floor 11.0 for arm64, 10.15 for x86) and applies it in MakeTargetMachineBuilder.

The same fix is open upstream as apache#55506 (apacheGH-55505).

Files: cpp/src/gandiva/engine.cc, engine.h, engine_llvm_test.cc, tests/decimal_test.cc (+190/-1).

Backport notes

  • One conflict, in MakeTargetMachineBuilder in engine.cc: dremio_27.0_26_20 has an extra jtmb.setRelocationModel(llvm::Reloc::PIC_); line that dremio_27.0_23_19 does not. Resolved by keeping both: the NormalizeDarwinTriple(...) constructor argument and the setRelocationModel line after it. The
    other three files applied without conflicts.

TESTING

  • gandiva-internals-test --gtest_filter=TestEngine.* (8 tests, includes the NormalizeDarwinTriple* tests) passes on this branch
  • gandiva-projector-test --gtest_filter=TestDecimal.TestRoundFloat64* (7 tests) passes on this branch

DX-128331

…ibcall is available (dremio#151)

* DX-128331: Gandiva: normalize Darwin host triple to macosx so exp10 libcall is available

* DX-128331: Gandiva: merge 'unchanged' Darwin triple normalization tests

* DX-128331: Gandiva: document why round(float64, int32) tests cover the exp10 lowering path

* DX-128331: Gandiva: move round(float64, scale) tests to decimal_test.cc

(cherry picked from commit 148cb48)
@lriggs
lriggs merged commit 13578e3 into dremio:dremio_27.0_26_20 Nov 12, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants