mrhhsg opened a new pull request, #70941: URL: https://github.com/apache/doris/pull/70941
### Background Short-circuit point queries fetch rows by primary key and can cache both the FE's output expressions and the BE's execution context for a prepared statement. Nereids can also ask the BE to evaluate constant expressions while planning. See [High-Concurrency Point Query](https://doris.apache.org/docs/4.x/query-acceleration/high-concurrent-point-query/). ### What problem does this PR solve? Issue Number: None Related PR: #56915 (introduced localized date names), #66788 (introduced the Hyperscan fallback setting), #60913 (related time zone propagation), #70345 (added time zone cache checks) PR Type: Bugfix Problem Summary: Point lookups and BE constant folding can use the wrong date-name locale, and BE folding can use a regex fallback the session disabled. In addition, long localized UTF-8 names can exceed the space allocated for English names. Forward the session settings, refresh the FE plan and BE context when the locale changes, and size the output for the active locale. The prepared regression evaluates a stored date and a date computed by constant folding: ```sql SELECT MONTHNAME(d), MONTHNAME(STR_TO_DATE(CONCAT('2026-11-', CAST(10 + CRC32('a') % 10 AS STRING)), '%Y-%m-%d')) FROM t WHERE id = ?; ``` With BE folding enabled, prepare once and execute the same statement under `zh_CN`, then under `en_US`, with `d = '2026-11-17'`. | Earlier result after the switch | With the fix | |---|---| | `November, εδΈζ` | `November, November` | ### Details - **Change map:** Production +52/-13, tests +557/-8, and 198 generated expected-output lines. The three commits cover session propagation and BE cache matching (+27/-6 production lines), localized UTF-8 sizing (+16/-4), and FE prepared-plan invalidation (+9/-3). - **Frequency:** Reproducible when an optimized request omits a setting that affects its result, when a reused prepared plan contains a literal folded under the previous locale, or when a localized name exceeds the English byte bound. - **Root cause:** `PointQueryExecutor` omitted the locale and `FoldConstantRuleOnBE` omitted the locale and fallback option. Even when the BE receives a new locale, it cannot reevaluate a literal in the cached `ShortCircuitQueryContext`. The date-name functions allocated using English size limits but copied localized ICU strings. - **Why existing tests missed it:** Point-query unit tests covered key binding and cache reuse without changing locale. `FoldConstantRuleOnBETest` checked expression selection before the RPC, and date-name BE unit tests used English. The SQL suites did not combine a locale switch, server-side prepared point queries, and a constant-folded projection. - **Fix:** Forward settings on the applicable optimized requests. Keep the existing BE cache rebuild and lookup retry, and invalidate the FE plan separately so folded literals are recomputed. Size `DAYNAME()` and `MONTHNAME()` using the longest UTF-8 name for the active locale. - **Other paths and branches:** Ordinary query execution already forwards the settings. The locale omissions and fixed buffer sizing were found on 4.0, 4.1, and 4.2; the Hyperscan omission was found on 4.1 and 4.2. Branch 3.1 predates both settings. Backports must account for cache differences and preserve optional Protobuf field ID 10. ### Testing - Local FE unit tests: 20 passed across `ShortCircuitQueryContextTest`, `SessionContextRequestTest`, and `ExecuteCommandTest`. - Local `test_point_query_lc_time_names`: the earlier FE package reproduced the wrong folded literal in both lookup modes and failed the comparison. The rebuilt FE passed with the existing ASAN BE, using the same server-prepared statement across locale switches in both modes. - Local `test_point_query_date_name_capacity` and `test_be_fold_session_context`: passed on the same cluster. No BE rebuild, cloud tests, or formal rolling-upgrade tests were run for the FE follow-up. ### Release note Correct date names in short-circuit point queries and BE constant folding, including when a prepared statement is reused after a session locale change, and honor disabled Hyperscan fallback during folding. ### Check List (For Author) - Behavior changed: No - Does this need documentation: No - Pre-submission status: Ready ### AI Disclosure - Tool: OpenAI Codex - Generated: Code, tests, and description - Human review: not stated -- 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]
