github-actions[bot] commented on code in PR #69998:
URL: https://github.com/apache/doris/pull/69998#discussion_r4443391797


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NestedColumnPruning.java:
##########
@@ -85,6 +85,11 @@ public class NestedColumnPruning implements CustomRewriter {
     public Plan rewriteRoot(Plan plan, JobContext jobContext) {
         try {
             StatementContext statementContext = 
jobContext.getCascadesContext().getStatementContext();
+            // Short-circuit point queries decode row-store payloads with the 
original full schema.
+            // Do not narrow complex slot types or attach nested access paths 
on this path.
+            if (statementContext.isShortCircuitQuery()) {

Review Comment:
   [P2] Recompute short-circuit eligibility for each prepared execution
   
   This guard returns before checking the current execution. 
`StatementContext.createNextExecuteContext()` copies the previous execution's 
`isShortCircuitQuery`, while `scanMatchShortCircuitCondition()` can reject the 
current session (for example after `enable_short_circuit_query` is turned off 
or the cached schema becomes stale). The next replan can therefore skip nested 
pruning and `StmtExecutor` can still choose `PointQueryExecutor` from the stale 
flag. Reset/recompute the flag and gate cached/direct execution on current 
eligibility; add a prepared `EXECUTE` toggle/schema-refresh regression.



##########
be/src/service/point_query_executor.cpp:
##########
@@ -135,6 +137,42 @@ Status Reusable::init(const TDescriptorTable& t_desc_tbl, 
const std::vector<TExp
     _runtime_state->set_query_options(query_options);
     RETURN_IF_ERROR(DescriptorTbl::create(_runtime_state->obj_pool(), 
t_desc_tbl, &_desc_tbl));
     _runtime_state->set_desc_tbl(_desc_tbl);

Review Comment:
   [P1] Do not accept stale positive UIDs through name fallback
   
   When a prepared or mixed-version descriptor has a missing positive 
`col_unique_id` but the same-name column exists (for example after a 
drop/re-add), this fallback compares the type against the new column and lets 
initialization proceed. The later `_col_uid_to_idx` map is still keyed by the 
descriptor's old UID, while row-store JSONB keys use the tablet's current UID, 
so decoding misses the value and silently inserts the FE default/NULL. Restrict 
name fallback to the legacy unset UID (or build an explicit UID translation) 
and reject stale positive IDs; add a regression for this schema mismatch.



##########
be/src/service/point_query_executor.cpp:
##########
@@ -135,6 +137,42 @@ Status Reusable::init(const TDescriptorTable& t_desc_tbl, 
const std::vector<TExp
     _runtime_state->set_query_options(query_options);
     RETURN_IF_ERROR(DescriptorTbl::create(_runtime_state->obj_pool(), 
t_desc_tbl, &_desc_tbl));
     _runtime_state->set_desc_tbl(_desc_tbl);
+    for (const auto* slot : tuple_desc()->slots()) {
+        const auto& all_paths = slot->all_access_paths();
+        const auto& predicate_paths = slot->predicate_access_paths();
+        if (all_paths.empty() && predicate_paths.empty()) {
+            continue;
+        }
+        auto is_whole_column_path = [&](const TColumnAccessPath& path) {
+            return path.type == TAccessPathType::DATA && 
path.__isset.data_access_path &&
+                   path.data_access_path.path.size() == 1 &&
+                   iequal(path.data_access_path.path[0], slot->col_name());
+        };
+        const bool whole_column_only = std::ranges::all_of(all_paths, 
is_whole_column_path) &&
+                                       std::ranges::all_of(predicate_paths, 
is_whole_column_path);

Review Comment:
   [P2] Preserve compatible full-type descriptors with nested paths
   
   An older FE can send nested paths such as `[s, first]` and `[s, second]` 
even when all STRUCT fields are selected, leaving the descriptor type equal to 
the stored full STRUCT but emitting no `[s]` root. This branch rejects that 
request because `whole_column_only` is false, although 
`JsonbSerializeUtil::jsonb_to_columns()` ignores access paths and the full 
SerDes layout is safe. Accept nested paths when the descriptor type matches the 
complete stored type (or normalize them to a verified root) so mixed-version 
point queries do not fail unnecessarily.



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