mrhhsg opened a new pull request, #71240:
URL: https://github.com/apache/doris/pull/71240
### What problem does this PR solve?
Issue Number: None
Related PR: #70941
Backport #70941 to `branch-4.2`.
Problem Summary:
Point lookups and BE constant folding do not consistently receive the
session settings used by normal execution. Prepared point queries can also
reuse locale-dependent folded literals or opened expression contexts after
`lc_time_names` changes. In addition, `DAYNAME` and `MONTHNAME` allocate output
using English name lengths, which can be too small for localized UTF-8 names.
### Changes
- Send `lc_time_names` on point-lookup requests, including lightweight
requests. Forward the session locale and `enable_hyperscan_fallback` to BE
constant folding.
- Capture the planning locale in the FE short-circuit context and invalidate
the cached plan when it changes, so folded literals are regenerated.
- Initialize BE timezone and locale before opening expressions. Reuse a
cached context only when both settings match; otherwise rebuild it without
changing contexts retained by in-flight requests. Keep the existing lightweight
context-resend path.
- Size date-name output using the active locale's maximum UTF-8 byte length
instead of the English bound.
- Add the optional protobuf field `lc_time_names = 10` without changing
existing field numbers.
### Branch-specific adaptation
Preserve `branch-4.2`'s effective-session constructor,
descriptor/access-path validation, and scalar-slot/literal projection
restrictions. This backport does not enable complex or non-slot projections in
the short-circuit path.
The prepared-query regression uses scalar slots plus a BE-folded date-name
literal and checks that the plan is short-circuit. Array and row-dependent
date-name projections retain the normal-path fallback. Adapt the unit tests to
Java 8 and the legacy mock runtime state; use text-protocol EXPLAIN while
keeping the actual SELECT server-prepared.
### Testing
Local validation for the unchanged patch:
- `./build.sh --be --fe -j 32`: passed (BE Release build and FE packaging).
- Focused FE tests (`ShortCircuitQueryContextTest`,
`SessionContextRequestTest`, `ExecuteCommandTest`): **23 passed**, no failures,
errors, or skips.
- `./run-be-ut.sh --run
--filter='VTimestampFunctionsTest.*:FoldConstantExecutorTest.*:LookupConnectionCacheTest.*:PointQueryReusableTest.*'
-j 32`: **97 passed** under ASAN.
- SQL regression suites: **3 passed**, no failed, fatal, or skipped suites:
- `test_point_query_lc_time_names`
- `test_point_query_date_name_capacity`
- `test_be_fold_session_context`
- Expected output regenerated by the regression runner and checked by a
separate comparison run.
- clang-format 16, FE Checkstyle (zero violations), and `git diff --check`:
passed.
SQL validation used an isolated local FE/BE configuration with BE Java
support disabled. Remote CI and formal cloud/mixed-version validation have not
been run.
### Release note
Fix session-setting consistency in point queries and BE constant folding,
refresh prepared point queries after locale changes, and prevent undersized
buffers for localized date names.
### Check List (For Author)
- Test
- [x] Regression test
- [x] Unit Test
- Behavior changed:
- [x] Yes. Optimized execution honors the applicable session settings,
locale changes refresh cached contexts, and localized date-name output uses
sufficient capacity.
- Does this need documentation?
- [x] No.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
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]