GH-48931: [C++] Optimize Decimal128 abs; add exec-only TPC-H Q1 benchmark #48929
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rationale for this change
Profiling
BM_Tpch_Q1_ExecOnlyin Acero shows a hotspot inBasicDecimal128::Abs(), and the existing TPC‑H Q1 benchmark mixes data generation with execution, making it hard to isolate execution costs. This change introduces an exec‑only Q1 benchmark for cleaner profiling and removes an avoidable temporary in Abs() to reduce overhead in decimal‑heavy execution. It also adjusts TDigest test tolerances on MSVC to align with existing libc++ precision behavior.What changes are included in the PR?
BM_Tpch_Q1_ExecOnlythat pre‑generates the lineitem table and benchmarks only plan executionBasicDecimal128::Abs()to useIsNegative()directly (avoids temporary +operator<)Are these changes tested?
Yes. I ran the C++ unit test subset labeled
unittestusing CTest with 4-way parallelism and failure output enabled:ctest -j4 -L unittest --output-on-failureAll 75 tests in that label passed.
Are there any user-facing changes?
No.
Github Issue: 48931