mrhhsg commented on code in PR #68311:
URL: https://github.com/apache/doris/pull/68311#discussion_r4060476162
##########
be/src/exprs/function/function_string_misc.cpp:
##########
@@ -826,6 +826,12 @@ class FunctionNgramSearch : public IFunction {
}
auto pattern = assert_cast<const
ColumnString*>(argument_columns[1].get())->get_data_at(0);
auto gram_num = assert_cast<const
ColumnInt32*>(argument_columns[2].get())->get_element(0);
+ // Constant expressions unsupported by FE are evaluated on BE. Check
the value here
+ // since common-subexpression extraction can replace the argument with
a slot reference.
+ if (gram_num <= 0) {
Review Comment:
Fixed in d4875959b04e86584aca59e929ed42534a2779b0.
The gram is now resolved and validated during function binding, before NULL
propagation, CSE, or empty-plan rewrites can discard the call. FE-evaluable
constants stay local; other constants use the existing BE evaluator regardless
of the optional BE-fold setting. The evaluated INT literal is retained in the
plan, and failed evaluation is reported rather than silently deferring
validation to execution.
BE also checks materialized grams before propagating NULL from text/pattern.
Regression coverage includes `crc32('abc') % 0`, zero/negative grams with zero
rows, CSE-shaped expressions, NULL text, `WHERE false`, and `LIMIT 0`, in both
fold modes. This also covers the case where NULL text previously removed the
entire function on FE, which a BE-only `open()` fix would miss.
Validation: FE UT 12/12, ASAN BE UT 7/7, ASAN FE/BE build, and the
new/existing string regression suites 2/2 passed. The prior 26 SQL probes now
produce the expected outcomes. clang-tidy remains blocked by the existing
unmatched NOLINTEND in core/types.h, with no emitted changed-line diagnostic.
The PR description explicitly records the additional planning RPC for
BE-only grams, its existing five-second timeout, and the planner-lock waiting
tradeoff. This thread is left for re-review rather than manually resolved.
--
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]