Doris-Breakwater commented on issue #71181: URL: https://github.com/apache/doris/issues/71181#issuecomment-7297486240
Confirmed an FE/Nereids constant-folding bug in the reported master build (`b4140d0b0538`) and 4.1.5 (`917b20be838`). `FoldConstantRuleOnFE` rewrites arguments before evaluating the outer function, so a nested `repeat()` reaches the same evaluator. `StringArithmetic.repeat()` multiplies the string length and the unboxed count as a Java `int`. The product can wrap below the 1,000,000-unit folding limit, allowing the FE JVM to allocate the result during planning, before BE query memory accounting applies. The reported `fe.out` sequence is consistent with the OOM kill hook in `start_fe.sh`. This can interrupt SQL service on a single-FE deployment. [Master folding rule](https://github.com/apache/doris/blob/b4140d0b0538f5bf2acedcf8aa7a4d664bbb4927/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnFE.java#L605-L612) · [Master guard](https://github.com/apache/doris/blob/b4140d0b0538f5bf2acedcf8aa7a4d664bbb4927/fe/fe-core/src/main/java/org/apache/ doris/nereids/trees/expressions/functions/executable/StringArithmetic.java#L736-L747) · [4.1.5 guard](https://github.com/apache/doris/blob/917b20be83878e98f94e3ebf7efccc80346e3e50/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java#L707-L718) · [FE startup](https://github.com/apache/doris/blob/b4140d0b0538f5bf2acedcf8aa7a4d664bbb4927/bin/start_fe.sh#L458-L466) The existing guard throws an `AnalysisException`, which `ExpressionEvaluator` handles by returning the original expression for later evaluation. On the BE, `repeat()` checks total string-column bytes before allocating the result. That check has a different limit from the FE folding guard. The reported `E-3113` verifies the BE check for the separate `str_to_map` case. The BE outcome for the original statements after the FE fix still needs verification. [Evaluator fallback](https://github.com/apache/doris/blob/b4140d0b0538f5bf2acedcf8aa7a4d664bbb4927/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java#L101-L114) · [4.1.5 BE size check](https://github.com/apache/doris/blob/917b20be83878e98f94e3ebf7efccc80346e3e50/be/src/exprs/function/function_string_concat.h#L623-L672) · [BE column limit](https://github.com/apache/doris/blob/917b20be83878e98f94e3ebf7efccc80346e3e50/be/src/core/column/column_string.h#L68-L82) Promote one operand to `long` before multiplying and keep the existing threshold and fallback. Add regression coverage for the overflow boundary in the guard without allocating the result, and verify that ordinary values still fold, including at the threshold. Consider a backport to the affected 4.1 line. The supplied build IDs and logs are sufficient to start the FE fix. If the patched build still loses the connection, please include the exact FE and BE build IDs, the active constant-folding settings, and the first FE or BE error. Those details will help identify which process failed after fallback. Breakwater-GitHub-Analysis-Slot: slot_d68ba81583f5 -- 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]
