This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new bcbf74e917b [fix](be) Fix Parquet FLOAT16 compilation with older 
libstdc++ (#69666)
bcbf74e917b is described below

commit bcbf74e917b539dbce925a19be8e7e385e9435bf
Author: EscaperLL <[email protected]>
AuthorDate: Tue Oct 27 18:22:38 2026 +0800

    [fix](be) Fix Parquet FLOAT16 compilation with older libstdc++ (#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
---
 be/src/format/parquet/parquet_column_convert.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/be/src/format/parquet/parquet_column_convert.h 
b/be/src/format/parquet/parquet_column_convert.h
index 3374a3e2dc9..98cecad5d13 100644
--- a/be/src/format/parquet/parquet_column_convert.h
+++ b/be/src/format/parquet/parquet_column_convert.h
@@ -22,6 +22,7 @@
 #include <libdivide.h>
 
 #include <chrono>
+#include <cmath>
 #include <limits>
 
 #include "common/cast_set.h"
@@ -614,7 +615,7 @@ public:
                 // half subnormal:
                 //    value = (-1)^sign * (mant / 2^10) * 2^(1 - bias)
                 // half bias = 15 → exponent = 1 - 15 = -14
-                float f = (static_cast<float>(mant) / 1024.0F) * 
std::powf(2.0F, -14.0F);
+                float f = (static_cast<float>(mant) / 1024.0F) * 
std::pow(2.0F, -14.0F);
                 return sign ? -f : f;
             }
         } else if (exp == 0x1F) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to