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


##########
regression-test/data/row_store/test_row_store_only.out:
##########
@@ -0,0 +1,35 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !initial --
+1      10      a       100
+2      20      b       200
+3      30      c       300
+
+-- !count_star --
+3
+
+-- !partial_update --
+1      10      a       100
+2      20      bb      200
+3      30      c       300
+4      0       d       7
+
+-- !point_lookup --
+bb     200
+
+-- !after_schema_change --
+1      10      a       100     9
+2      20      bb      200     9
+3      30      c       300     9
+4      0       d       7       9
+5      50      e       500     5000
+
+-- !after_full_compaction --
+1      10      a       100     9
+2      20      bb      200     9
+3      30      c       300     9
+4      0       d       7       9
+5      50      e       500     5000
+
+-- !complex_query_when_block_disabled --
+115
+

Review Comment:
   `git diff --check` still fails on this file because the new expected output 
ends with a blank line after the final `115` row. Please trim the trailing 
blank line or regenerate the `.out` file so the PR does not fail whitespace 
validation.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/CheckAfterRewrite.java:
##########
@@ -65,10 +70,59 @@ public Rule build() {
             checkUnexpectedExpression(plan);
             checkMetricTypeIsUsedCorrectly(plan);
             checkMatchIsUsedCorrectly(plan);
+            checkRowStoreOnlyComplexQuery(plan);
             return null;
         }).toRule(RuleType.CHECK_ANALYSIS);
     }
 
+    private void checkRowStoreOnlyComplexQuery(Plan plan) {
+        if (shouldBlockRowStoreOnlyComplexQuery(plan)) {
+            throw new 
AnalysisException(ROW_STORE_ONLY_COMPLEX_QUERY_ERROR_MSG);
+        }
+    }
+
+    private boolean shouldBlockRowStoreOnlyComplexQuery(Plan plan) {
+        if (!Config.enable_row_store_only_complex_query_block) {
+            return false;
+        }
+
+        boolean hasRowStoreOnlyOlapScan = 
plan.collect(OlapScan.class::isInstance).stream()
+                .map(OlapScan.class::cast)
+                .anyMatch(scan -> scan.getTable().rowStoreOnly());
+        if (!hasRowStoreOnlyOlapScan) {
+            return false;
+        }
+
+        if (plan.anyMatch(node -> node instanceof LogicalJoin)) {

Review Comment:
   This check is still too broad because it first asks whether the whole 
current plan subtree contains any row-store-only scan, then independently asks 
whether that same subtree contains any join or non-count-star aggregate. That 
rejects valid mixed plans where the row-store-only table is only scanned in one 
branch and the aggregate/join is in an unrelated normal-table branch, for 
example `UNION ALL (SELECT k FROM row_store_only_t, SELECT SUM(v) FROM 
normal_t)`. Please make the blocker local to the operator/subtree that actually 
consumes row-store-only rows, and add a regression for a row-store-only branch 
combined with an unrelated aggregate/join branch.



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