EscaperLL opened a new pull request, #69666:
URL: https://github.com/apache/doris/pull/69666

   ### What problem does this PR solve?
   
   Issue Number: N/A
   
   Related PR: #69647 (closed without merging)
   
   Problem Summary: Parquet FLOAT16 conversion calls `std::powf(2.0F, -14.0F)`. 
Older libstdc++ headers do not expose `powf` in namespace `std`, causing BE 
compilation to fail even when `<cmath>` is included. This is reproducible with 
GCC 12.3.0 and Clang 22.1.8 using their default libstdc++ configurations, 
although these compiler versions pass Doris's compiler version checks.
   
   GCC added the missing namespace declarations, including `powf`, in [PR79700 
/ r14-5341](https://gcc.gnu.org/pipermail/gcc-bugs/2023-November/841727.html).
   
   Include `<cmath>` explicitly and replace the call with `std::pow(2.0F, 
-14.0F)`. Both arguments remain `float`, selecting the overload that returns 
`float` and preserving the existing conversion semantics. This fixes standard 
library API availability without changing the Parquet format or FLOAT16 
encoding.
   
   The PR contains one fix commit changing only 
`be/src/format/parquet/parquet_column_convert.h` (+2/-1). It supersedes #69647 
with validation on master baseline `da4f490ae`; no LZ4HC changes are included.
   
   ### Release note
   
   Fix BE compilation for Parquet FLOAT16 conversion with older libstdc++.
   
   ### Check List (For Author)
   
   - Test
       - [ ] Regression test
       - [x] Unit Test
       - [x] Manual test (steps and results below)
       - [ ] No need to test or manual test. Explain why:
   
   Validation on this branch:
   
   - **Unit tests:** `BUILD_TYPE_UT=ASAN ./run-be-ut.sh --run 
--filter='ParquetColumnConvertTest.*' -j 6` passed all 17 tests, with no 
failures, errors, disabled tests, or skips. This suite does **not** directly 
exercise the FLOAT16 branch.
   - **Compilation reproducer:** GCC 12.3.0 and Clang 22.1.8 both reject the 
original call and accept the replacement in C++20 mode. A `static_assert` 
confirms that the replacement returns `float`; reproduction steps are below.
   - **Numerical check:** The conversion function extracted from the current 
header matches a `::powf` baseline bit-for-bit for all 65,536 FLOAT16 patterns 
with both compilers at `-O0` and `-O2`. All subnormal values also match an 
independent exact reference. This standalone check does not replace a complete 
FLOAT16 file-reading regression test.
   - **Style and static checks:** clang-format 16 formatting/check scripts, 
build hygiene, and `git diff --check` passed. The repository clang-tidy script 
reported success with a broken-pipe message; a subsequent direct clang-tidy 
invocation filtered to the changed lines exited successfully without 
diagnostics on those lines.
   - **Full BE build limitation:** `BUILD_TYPE=ASAN ./build.sh --be -j 2` 
completed source compilation and linked `doris_be`, but the overall command 
**failed** the glibc 2.17 compatibility gate. The artifact requires newer 
symbols, including `statx@GLIBC_2.28` and `hypotf@GLIBC_2.35`. The linked 
`powf` requirement is `GLIBC_2.2.5`, which does not establish compatibility of 
the whole artifact. The gate was not bypassed; dictionary generation and 
packaging were not verified complete. A successful standard CI build is still 
needed before merging.
   - **Regression limitation:** `test_hdfs_tvf_float16` was not run because the 
external Hive/HDFS test environment is not enabled (`enableHiveTest=false`).
   
   <details>
   <summary>Minimal compilation reproducer</summary>
   
   Run with GCC 12.3.0 or Clang 22.1.8 configured to use the affected libstdc++ 
headers:
   
   ```bash
   cat > /tmp/doris_float16_original.cpp <<'CPP'
   #include <cmath>
   #include <type_traits>
   
   auto value = std::powf(2.0F, -14.0F);
   static_assert(std::is_same_v<decltype(value), float>);
   CPP
   
   sed 's/std::powf/std::pow/' /tmp/doris_float16_original.cpp \
       > /tmp/doris_float16_fixed.cpp
   
   # Expected: compilation error for the original; success for the replacement.
   g++ -std=c++20 -fsyntax-only /tmp/doris_float16_original.cpp
   g++ -std=c++20 -fsyntax-only /tmp/doris_float16_fixed.cpp
   clang++ -std=c++20 -fsyntax-only /tmp/doris_float16_original.cpp
   clang++ -std=c++20 -fsyntax-only /tmp/doris_float16_fixed.cpp
   ```
   
   </details>
   
   - Behavior changed:
       - [x] No. FLOAT16 conversion semantics are preserved.
       - [ ] Yes.
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label
   


-- 
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]

Reply via email to