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


##########
be/src/exec/scan/olap_scanner.cpp:
##########
@@ -496,16 +497,26 @@ Status OlapScanner::_init_tablet_reader_params(
             add_return_column_if_absent(static_cast<uint32_t>(op_idx));
         }
 
-        for (auto cid : _return_columns) {
-            if (cid >= tablet_schema->num_key_columns()) {
-                const auto& col_name = tablet_schema->column(cid).name();
-                std::string before_col_name;
-                before_col_name.append("__BEFORE__");
-                before_col_name.append(col_name);
-                before_col_name.append("__");
-                if (int32_t before_idx = 
tablet_schema->field_index(before_col_name);
-                    before_idx >= 0) {
-                    
add_return_column_if_absent(static_cast<uint32_t>(before_idx));
+        if (is_min_delta_scan) {
+            // No-op UPDATE detection compares the complete row state at the 
two ends of the
+            // window. Read every AFTER/BEFORE value column even when SQL 
projects only a subset;
+            // BlockReader's return-column mapping keeps these comparison-only 
columns hidden.
+            for (uint32_t cid = tablet_schema->num_key_columns();
+                 cid < tablet_schema->num_columns(); ++cid) {
+                add_return_column_if_absent(cid);

Review Comment:
   [P1] Build this full projection without a linear search per column. 
add_return_column_if_absent() runs std::find over the growing return_columns 
vector, and this new loop calls it for all C physical binlog columns, so each 
tablet/range scanner now does roughly C^2/2 integer comparisons even for a 
narrow query. That is separate from the quadratic name lookup later in 
BlockReader. Please track selected dense column ids with a bitmap/set or append 
the remaining schema columns in one linear pass while preserving the required 
output order.



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