mrhhsg commented on code in PR #68258:
URL: https://github.com/apache/doris/pull/68258#discussion_r4056602494


##########
be/src/exprs/function/math.cpp:
##########
@@ -643,6 +643,15 @@ class FunctionMathBinary : public IFunction {
             auto& a = column_left_ptr->get_data();
             auto& c = column_result->get_data();
             size_t size = a.size();
+            if constexpr (std::is_same_v<Impl, PowImpl>) {
+                // Dispatch once per block, keeping libm calls out of the 
squaring loop.
+                if (column_right_ptr->template get_value<Impl::type>() == 2.0) 
{

Review Comment:
   已在 5dc76d3239d6294b6ef530472dda58bab75f8558 处理,采用建议中的“撤回 specialization”方案。
   
   - 已用实际 BE 复现该反例:libm 结果 bits 为 `0x38e5fa01b171cd7a`,原快路径为 
`0x38e5fa01b171cd7b`;SQL 精确比较返回 false。
   - 移除了乘法快路径。当前 PR 的 production `math.cpp` 与 base 完全一致,因此不引入新的列形态或滚动升级语义差异;PR 
已改为测试补强,移除原性能收益描述。
   - UT 将该反例放在输入首位,覆盖 4 个别名 × 4 种 const mask × Nullable/Non-Nullable。非 NaN 结果改为 
`uint64_t` 位级比较,reference 使用动态 exponent 调用 libm,避免编译器把 oracle 也化成乘法。新增 UT 
在原实现失败,撤回快路径后通过。
   - 增加有序 SQL 精确相等回归,正负反例在四个别名下均为 true。基数由输入行计算,避免 FE 提前折叠;EXPLAIN 已确认比较表达式保留在 
BE。
   
   验证:ASAN BE build;MathFunctionTest 47 passed、1 个既有 release-only 
skip;test_pow_square(生成 .out 后普通复跑)和 test_math_function 均通过;format、build 
hygiene、diff check、changed-line clang-tidy 通过(沿用 PR body 
披露的本地工具兼容处理)。没有宣称解决原性能优化目标,也未改动 FE 常量折叠。
   



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