Copilot commented on code in PR #56266:
URL: https://github.com/apache/doris/pull/56266#discussion_r2522424105


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java:
##########
@@ -543,6 +544,32 @@ public static Set<Expression> replace(Set<Expression> 
exprs,
         return result.build();
     }
 
+    /**
+     * replaceNullAware, if could not be replaced by map, the return null

Review Comment:
   Grammatical error: "if could not be replaced" should be "if it could not be 
replaced" or "if unable to be replaced".
   ```suggestion
        * replaceNullAware, if it could not be replaced by map, then return null
   ```



##########
regression-test/suites/nereids_rules_p0/mv/join_elim_p_f_key/join_elim_star_pattern.groovy:
##########
@@ -0,0 +1,592 @@
+package mv.join_elim_p_f_key
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("join_elim_star_pattern") {
+    String db = context.config.getDbNameByFile(context.file)
+    sql "use ${db}"
+    sql "SET enable_nereids_planner=true"
+    sql "SET enable_fallback_to_original_planner=false"
+    sql "SET enable_materialized_view_rewrite=true"
+    sql "SET enable_nereids_timeout = false"
+
+    sql """
+    drop table if exists orders_1
+    """
+
+    sql """CREATE TABLE `orders_1` (
+      `o_orderkey` BIGINT NOT NULL,
+      `o_partkey` INT NOT NULL,
+      `o_suppkey` INT NOT NULL,
+      `o_custkey` INT NULL,
+      `o_orderstatus` VARCHAR(1) NULL,
+      `o_totalprice` DECIMAL(15, 2)  NULL,
+      `o_orderpriority` VARCHAR(15) NULL,
+      `o_clerk` VARCHAR(15) NULL,
+      `o_shippriority` INT NULL,
+      `o_comment` VARCHAR(79) NULL,
+      `o_orderdate` DATE not NULL
+    ) ENGINE=OLAP
+    DUPLICATE KEY(`o_orderkey`)
+    COMMENT 'OLAP'
+    auto partition by range (date_trunc(`o_orderdate`, 'day')) ()
+    DISTRIBUTED BY HASH(`o_orderkey`) BUCKETS 96
+    PROPERTIES (
+    "replication_allocation" = "tag.location.default: 1"
+    );"""
+
+    sql """
+    drop table if exists lineitem_1
+    """
+
+    sql """CREATE TABLE `lineitem_1` (
+      `l_orderkey` BIGINT NOT NULL,
+      `l_linenumber` INT NULL,
+      `l_partkey` INT NOT NULL,
+      `l_suppkey` INT NOT NULL,
+      `l_quantity` DECIMAL(15, 2) NULL,
+      `l_extendedprice` DECIMAL(15, 2) NULL,
+      `l_discount` DECIMAL(15, 2) NULL,
+      `l_tax` DECIMAL(15, 2) NULL,
+      `l_returnflag` VARCHAR(1) NULL,
+      `l_linestatus` VARCHAR(1) NULL,
+      `l_commitdate` DATE NULL,
+      `l_receiptdate` DATE NULL,
+      `l_shipinstruct` VARCHAR(25) NULL,
+      `l_shipmode` VARCHAR(10) NULL,
+      `l_comment` VARCHAR(44) NULL,
+      `l_shipdate` DATE not NULL
+    ) ENGINE=OLAP
+    DUPLICATE KEY(l_orderkey)
+    COMMENT 'OLAP'
+    auto partition by range (date_trunc(`l_shipdate`, 'day')) ()
+    DISTRIBUTED BY HASH(`l_orderkey`) BUCKETS 96
+    PROPERTIES (
+    "replication_allocation" = "tag.location.default: 1"
+    );"""
+
+    sql """
+    drop table if exists partsupp_1
+    """
+
+    sql """CREATE TABLE `partsupp_1` (
+      `ps_partkey` INT NOT NULL,
+      `ps_suppkey` INT NOT NULL,
+      `ps_availqty` INT NULL,
+      `ps_supplycost` DECIMAL(15, 2) NULL,
+      `ps_comment` VARCHAR(199) NULL
+    ) ENGINE=OLAP
+    DUPLICATE KEY(`ps_partkey`)
+    COMMENT 'OLAP'
+    DISTRIBUTED BY HASH(`ps_partkey`) BUCKETS 24
+    PROPERTIES (
+    "replication_allocation" = "tag.location.default: 1"
+    );"""
+
+
+    sql """
+    INSERT INTO orders_1 (
+        o_orderkey, o_partkey, o_suppkey, o_custkey, o_orderstatus,
+        o_totalprice, o_orderpriority, o_clerk, o_shippriority, o_comment, 
o_orderdate
+    ) VALUES
+    (1001, 501, 201, 3001, 'O', 1500.00, '1-URGENT', 'Clerk#001', 0, '紧急订单', 
'2024-01-15'),
+    (1002, 502, 202, 3002, 'F', 2500.00, '2-HIGH', 'Clerk#002', 1, '普通订单', 
'2024-02-20'),
+    (1003, 503, 203, 3003, 'O', 1800.00, '3-MEDIUM', 'Clerk#003', 0, '中等优先级', 
'2024-03-05'),
+    (1004, 504, 204, 3004, 'F', 3200.00, '4-NOT SPEC', 'Clerk#004', 1, '大额订单', 
'2024-03-15'),
+    (1005, 505, 205, 3005, 'O', 950.00, '5-LOW', 'Clerk#005', 0, '小额订单', 
'2024-04-01'),
+    (1006, 506, 206, 3005, 'O', 950.00, '5-LOW', 'Clerk#005', 0, '小额订单', 
'2024-04-01'),
+    (1007, 507, 207, 3005, 'O', 950.00, '5-LOW', 'Clerk#005', 0, '小额订单', 
'2024-04-01'),
+    (1008, 508, 208, 3005, 'O', 950.00, '5-LOW', 'Clerk#005', 0, '小额订单', 
'2024-04-01');
+    
+    INSERT INTO lineitem_1 (
+        l_orderkey, l_linenumber, l_partkey, l_suppkey, l_quantity,
+        l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus,
+        l_commitdate, l_receiptdate, l_shipinstruct, l_shipmode, l_comment, 
l_shipdate
+    ) VALUES
+    (1001, 1, 501, 201, 5.00, 500.00, 0.05, 0.10, 'N', 'O', '2024-01-16', 
'2024-01-20', 'DELIVER IN PERSON', 'TRUCK', '订单1001第一行', '2024-01-18'),
+    (1001, 2, 502, 202, 10.00, 1000.00, 0.10, 0.15, 'N', 'O', '2024-01-16', 
'2024-01-20', 'NONE', 'AIR', '订单1001第二行', '2024-01-18'),
+    (1002, 1, 503, 203, 8.00, 800.00, 0.08, 0.12, 'N', 'O', '2024-02-21', 
'2024-02-25', 'TAKE BACK RETURN', 'MAIL', '订单1002第一行', '2024-02-22'),
+    (1002, 2, 504, 204, 12.00, 1200.00, 0.12, 0.18, 'N', 'O', '2024-02-21', 
'2024-02-26', 'COLLECT COD', 'SHIP', '订单1002第二行', '2024-02-23'),
+    (1003, 1, 505, 205, 6.00, 600.00, 0.06, 0.12, 'N', 'O', '2024-03-06', 
'2024-03-10', 'DELIVER IN PERSON', 'TRUCK', '订单1003第一行', '2024-03-08'),
+    (1003, 2, 506, 206, 9.00, 900.00, 0.09, 0.15, 'N', 'O', '2024-03-06', 
'2024-03-11', 'NONE', 'AIR', '订单1003第二行', '2024-03-09'),
+    (1004, 1, 507, 207, 10.00, 1000.00, 0.10, 0.18, 'N', 'O', '2024-03-16', 
'2024-03-20', 'TAKE BACK RETURN', 'MAIL', '订单1004第一行', '2024-03-18'),
+    (1004, 2, 508, 208, 15.00, 1500.00, 0.15, 0.22, 'N', 'O', '2024-03-16', 
'2024-03-21', 'COLLECT COD', 'SHIP', '订单1004第二行', '2024-03-19'),
+    (1005, 1, 509, 209, 4.00, 400.00, 0.04, 0.08, 'N', 'O', '2024-04-02', 
'2024-04-06', 'DELIVER IN PERSON', 'TRUCK', '订单1005第一行', '2024-04-04'),
+    (1005, 2, 510, 210, 5.50, 550.00, 0.05, 0.11, 'N', 'O', '2024-04-02', 
'2024-04-07', 'NONE', 'AIR', '订单1005第二行', '2024-04-05');
+
+    INSERT INTO partsupp_1 (
+        ps_partkey, ps_suppkey, ps_availqty, ps_supplycost, ps_comment
+    ) VALUES
+    (501, 201, 100, 50.00, '零件501供应商201'),
+    (502, 202, 200, 75.00, '零件502供应商202'),
+    (503, 203, 150, 60.00, '零件503供应商203'),
+    (504, 204, 180, 65.00, '零件504供应商204'),
+    (505, 205, 120, 55.00, '零件505供应商205'),
+    (506, 206, 90, 70.00,  '零件506供应商206'),
+    (507, 207, 160, 80.00, '零件507供应商207'),
+    (508, 208, 140, 75.00, '零件508供应商208'),
+    (509, 209, 110, 85.00, '零件509供应商209'),
+    (510, 210, 130, 90.00, '零件510供应商210');
+    """
+
+    sql """analyze table lineitem_1 with sync;"""
+    sql """analyze table orders_1 with sync;"""
+    sql """analyze table partsupp_1 with sync;"""
+    sql """alter table lineitem_1 modify column l_comment set stats 
('row_count'='10');"""
+    sql """alter table orders_1 modify column o_comment set stats 
('row_count'='8');"""
+    sql """alter table partsupp_1 modify column ps_comment set stats 
('row_count'='10');"""
+
+
+    def compare_res = { def stmt, int orderByColumns = 1 ->
+        sql "SET enable_materialized_view_rewrite=false"
+        def orderStmt = " order by " + (1..orderByColumns).join(", ")
+        def origin_res = sql stmt + orderStmt
+        logger.info("origin_res: " + origin_res)
+        sql "SET enable_materialized_view_rewrite=true"
+        def mv_origin_res = sql stmt + orderStmt
+        logger.info("mv_origin_res: " + mv_origin_res)
+        assertTrue((mv_origin_res == [] && origin_res == []) || 
(mv_origin_res.size() == origin_res.size()))
+        for (int row = 0; row < mv_origin_res.size(); row++) {
+            assertTrue(mv_origin_res[row].size() == origin_res[row].size())
+            for (int col = 0; col < mv_origin_res[row].size(); col++) {
+                assertTrue(mv_origin_res[row][col] == origin_res[row][col])
+            }
+        }
+    }
+
+    def dropAllConstraints = { def tableName ->
+        def getConstraintsQuery = "SHOW CONSTRAINTS FROM ${tableName}"
+        def constraints = sql getConstraintsQuery
+        logger.info("needed deleted constraints : ${constraints}")
+        constraints.each { constraint ->
+            def constraintName = constraint[0]
+            def dropConstraintSQL = "ALTER TABLE ${tableName} DROP CONSTRAINT 
${constraintName}"
+            sql dropConstraintSQL
+            logger.info("delete ${tableName} constraits : ${constraintName}")

Review Comment:
   Spelling error: "constraits" should be "constraints".
   ```suggestion
               logger.info("delete ${tableName} constraints : 
${constraintName}")
   ```



##########
regression-test/suites/nereids_rules_p0/mv/join_elim_p_f_key/join_elim_line_pattern.groovy:
##########
@@ -0,0 +1,558 @@
+package mv.join_elim_p_f_key
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("join_elim_line_pattern") {
+    String db = context.config.getDbNameByFile(context.file)
+    sql "use ${db}"
+    sql "SET enable_nereids_planner=true"
+    sql "SET enable_fallback_to_original_planner=false"
+    sql "SET enable_materialized_view_rewrite=true"
+    sql "SET enable_nereids_timeout = false"
+
+    sql """
+    drop table if exists orders
+    """
+
+    sql """CREATE TABLE `orders` (
+      `o_orderkey` BIGINT NULL,
+      `o_partkey` INT NULL,
+      `o_suppkey` INT NULL,
+      `o_custkey` INT NULL,
+      `o_orderstatus` VARCHAR(1) NULL,
+      `o_totalprice` DECIMAL(15, 2)  NULL,
+      `o_orderpriority` VARCHAR(15) NULL,
+      `o_clerk` VARCHAR(15) NULL,
+      `o_shippriority` INT NULL,
+      `o_comment` VARCHAR(79) NULL,
+      `o_orderdate` DATE not NULL
+    ) ENGINE=OLAP
+    DUPLICATE KEY(`o_orderkey`)
+    COMMENT 'OLAP'
+    auto partition by range (date_trunc(`o_orderdate`, 'day')) ()
+    DISTRIBUTED BY HASH(`o_orderkey`) BUCKETS 96
+    PROPERTIES (
+    "replication_allocation" = "tag.location.default: 1"
+    );"""
+
+    sql """
+    drop table if exists lineitem
+    """
+
+    sql """CREATE TABLE `lineitem` (
+      `l_orderkey` BIGINT NOT NULL,
+      `l_linenumber` INT NULL,
+      `l_partkey` INT NOT NULL,
+      `l_suppkey` INT NOT NULL,
+      `l_quantity` DECIMAL(15, 2) NULL,
+      `l_extendedprice` DECIMAL(15, 2) NULL,
+      `l_discount` DECIMAL(15, 2) NULL,
+      `l_tax` DECIMAL(15, 2) NULL,
+      `l_returnflag` VARCHAR(1) NULL,
+      `l_linestatus` VARCHAR(1) NULL,
+      `l_commitdate` DATE NULL,
+      `l_receiptdate` DATE NULL,
+      `l_shipinstruct` VARCHAR(25) NULL,
+      `l_shipmode` VARCHAR(10) NULL,
+      `l_comment` VARCHAR(44) NULL,
+      `l_shipdate` DATE not NULL
+    ) ENGINE=OLAP
+    DUPLICATE KEY(l_orderkey)
+    COMMENT 'OLAP'
+    auto partition by range (date_trunc(`l_shipdate`, 'day')) ()
+    DISTRIBUTED BY HASH(`l_orderkey`) BUCKETS 96
+    PROPERTIES (
+    "replication_allocation" = "tag.location.default: 1"
+    );"""
+
+    sql """
+    drop table if exists partsupp
+    """
+
+    sql """CREATE TABLE `partsupp` (
+      `ps_partkey` INT NULL,
+      `ps_suppkey` INT NULL,
+      `ps_availqty` INT NULL,
+      `ps_supplycost` DECIMAL(15, 2) NULL,
+      `ps_comment` VARCHAR(199) NULL
+    ) ENGINE=OLAP
+    DUPLICATE KEY(`ps_partkey`)
+    COMMENT 'OLAP'
+    DISTRIBUTED BY HASH(`ps_partkey`) BUCKETS 24
+    PROPERTIES (
+    "replication_allocation" = "tag.location.default: 1"
+    );"""
+
+
+    sql """
+    INSERT INTO orders (
+        o_orderkey, o_partkey, o_suppkey, o_custkey, o_orderstatus,
+        o_totalprice, o_orderpriority, o_clerk, o_shippriority, o_comment, 
o_orderdate
+    ) VALUES
+    (1001, 501, 201, 3001, 'O', 1500.00, '1-URGENT', 'Clerk#001', 0, '紧急订单', 
'2024-01-15'),
+    (1001, 501, 201, 3001, 'O', 1500.00, '1-URGENT', 'Clerk#001', 0, '紧急订单', 
'2024-01-15'),
+    (1002, 502, 202, 3002, 'F', 2500.00, '2-HIGH', 'Clerk#002', 1, '普通订单', 
'2024-02-20'),
+    (1002, 502, 202, 3002, 'F', 2500.00, '2-HIGH', 'Clerk#002', 1, '普通订单', 
'2024-02-20'),
+    (1003, 503, 203, 3003, 'O', 1800.00, '3-MEDIUM', 'Clerk#003', 0, '中等优先级', 
'2024-03-05'),
+    (1003, 503, 203, 3003, 'O', 1800.00, '3-MEDIUM', 'Clerk#003', 0, '中等优先级', 
'2024-03-05'),
+    (1004, 504, 204, 3004, 'F', 3200.00, '4-NOT SPEC', 'Clerk#004', 1, '大额订单', 
'2024-03-15'),
+    (1004, 504, 204, 3004, 'F', 3200.00, '4-NOT SPEC', 'Clerk#004', 1, '大额订单', 
'2024-03-15'),
+    (1005, 505, 205, 3005, 'O', 950.00, '5-LOW', 'Clerk#005', 0, '小额订单', 
'2024-04-01'),
+    (1005, 505, 205, 3005, 'O', 950.00, '5-LOW', 'Clerk#005', 0, '小额订单', 
'2024-04-01');
+    
+    INSERT INTO lineitem (
+        l_orderkey, l_linenumber, l_partkey, l_suppkey, l_quantity,
+        l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus,
+        l_commitdate, l_receiptdate, l_shipinstruct, l_shipmode, l_comment, 
l_shipdate
+    ) VALUES
+    -- 订单1001的明细
+    (1001, 1, 501, 201, 5.00, 500.00, 0.05, 0.10, 'N', 'O', '2024-01-16', 
'2024-01-20', 'DELIVER IN PERSON', 'TRUCK', '订单1001第一行', '2024-01-18'),
+    (1002, 1, 502, 202, 8.00, 800.00, 0.08, 0.12, 'N', 'O', '2024-02-21', 
'2024-02-25', 'TAKE BACK RETURN', 'MAIL', '订单1002第一行', '2024-02-22'),
+    (1003, 1, 503, 203, 6.00, 600.00, 0.06, 0.12, 'N', 'O', '2024-03-06', 
'2024-03-10', 'DELIVER IN PERSON', 'TRUCK', '订单1003第一行', '2024-03-08'),
+    (1004, 1, 504, 204, 10.00, 1000.00, 0.10, 0.18, 'N', 'O', '2024-03-16', 
'2024-03-20', 'TAKE BACK RETURN', 'MAIL', '订单1004第一行', '2024-03-18'),
+    (1005, 1, 505, 205, 4.00, 400.00, 0.04, 0.08, 'N', 'O', '2024-04-02', 
'2024-04-06', 'DELIVER IN PERSON', 'TRUCK', '订单1005第一行', '2024-04-04');
+
+
+    INSERT INTO partsupp (
+        ps_partkey, ps_suppkey, ps_availqty, ps_supplycost, ps_comment
+    ) VALUES
+    (501, 201, 100, 50.00, '零件501供应商201'),
+    (502, 202, 200, 75.00, '零件502供应商202'),
+    (503, 203, 150, 60.00, '零件503供应商203'),
+    (504, 204, 180, 65.00, '零件504供应商204'),
+    (505, 205, 120, 55.00, '零件505供应商205');
+    """
+
+    sql """analyze table lineitem with sync;"""
+    sql """analyze table orders with sync;"""
+    sql """analyze table partsupp with sync;"""
+    sql """alter table lineitem modify column l_comment set stats 
('row_count'='10');"""
+    sql """alter table orders modify column o_comment set stats 
('row_count'='5');"""
+    sql """alter table partsupp modify column ps_comment set stats 
('row_count'='5');"""
+
+    def compare_res = { def stmt, int orderByColumns = 1 ->
+        sql "SET enable_materialized_view_rewrite=false"
+        def orderStmt = " order by " + (1..orderByColumns).join(", ")
+        def origin_res = sql stmt + orderStmt
+        logger.info("origin_res: " + origin_res)
+        sql "SET enable_materialized_view_rewrite=true"
+        def mv_origin_res = sql stmt + orderStmt
+        logger.info("mv_origin_res: " + mv_origin_res)
+        assertTrue((mv_origin_res == [] && origin_res == []) || 
(mv_origin_res.size() == origin_res.size()))
+        for (int row = 0; row < mv_origin_res.size(); row++) {
+            assertTrue(mv_origin_res[row].size() == origin_res[row].size())
+            for (int col = 0; col < mv_origin_res[row].size(); col++) {
+                assertTrue(mv_origin_res[row][col] == origin_res[row][col])
+            }
+        }
+    }
+
+    def dropAllConstraints = { def tableName ->
+        def getConstraintsQuery = "SHOW CONSTRAINTS FROM ${tableName}"
+        def constraints = sql getConstraintsQuery
+        logger.info("needed deleted constraints : ${constraints}")
+        constraints.each { constraint ->
+            def constraintName = constraint[0]
+            def dropConstraintSQL = "ALTER TABLE ${tableName} DROP CONSTRAINT 
${constraintName}"
+            sql dropConstraintSQL
+            logger.info("delete ${tableName} constraits : ${constraintName}")

Review Comment:
   Spelling error: "constraits" should be "constraints".
   ```suggestion
               logger.info("delete ${tableName} constraints : 
${constraintName}")
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/HyperGraphComparator.java:
##########
@@ -232,15 +253,46 @@ private boolean canEliminateViewEdge(JoinEdge joinEdge) {
     private boolean tryEliminateNodesAndEdge() {
         boolean hasFilterEdgeAbove = viewHyperGraph.getFilterEdges().stream()
                 .filter(e -> LongBitmap.getCardinality(e.getReferenceNodes()) 
== 1)
-                .anyMatch(e -> LongBitmap.isSubset(e.getReferenceNodes(), 
eliminateViewNodesMap));
+                .anyMatch(e -> LongBitmap.isSubset(e.getReferenceNodes(), 
shouldEliminateViewNodesMap));
         if (hasFilterEdgeAbove) {
             // If there is some filter edge above the eliminated node, we 
should rebuild a plan
             // Right now, just reject it.
             return false;
         }
-        return viewHyperGraph.getJoinEdges().stream()
-                .filter(joinEdge -> 
LongBitmap.isOverlap(joinEdge.getReferenceNodes(), eliminateViewNodesMap))
-                .allMatch(this::canEliminateViewEdge);
+        long allCanEliminateNodes = 0;
+        for (JoinEdge joinEdge : viewHyperGraph.getJoinEdges()) {
+            long canEliminateSideNodes = getCanEliminateSideNodes(joinEdge);
+            allCanEliminateNodes = LongBitmap.or(allCanEliminateNodes, 
canEliminateSideNodes);
+            if (LongBitmap.isOverlap(canEliminateSideNodes, 
reservedShouldEliminatedViewNodes)
+                    && !canEliminateViewEdge(joinEdge)) {
+                return false;
+            }
+        }
+        // check all can eliminateNodes contains all should eliminate nodes, 
to avoid some nodes can not be eliminated

Review Comment:
   Grammatical error: "can not be eliminated" should be "cannot be eliminated" 
(one word).
   ```suggestion
           // check all can eliminateNodes contains all should eliminate nodes, 
to avoid some nodes cannot be eliminated
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/HyperGraphComparator.java:
##########
@@ -558,12 +610,17 @@ private boolean compareFilterEdgeWithNode(FilterEdge 
query, FilterEdge view) {
 
     private boolean compareJoinEdgeWithNode(JoinEdge query, JoinEdge view) {
         boolean res = false;
+        // if eliminateViewNodesMap is not empty, we should compare the join 
nodes after eliminating

Review Comment:
   Inconsistent comment style: The comment says "if eliminateViewNodesMap is 
not empty" but the variable being referenced is actually 
`shouldEliminateViewNodesMap`. The comment should be updated to match the 
actual variable name for clarity.
   ```suggestion
           // if shouldEliminateViewNodesMap is not empty, we should compare 
the join nodes after eliminating
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/visitor/ExpressionLineageReplacer.java:
##########
@@ -84,6 +84,13 @@ public static class ExpressionReplacer extends 
DefaultExpressionRewriter<Map<Exp
         public Expression visitNamedExpression(NamedExpression namedExpression,
                 Map<ExprId, Expression> exprIdExpressionMap) {
             Expression childExpr = 
exprIdExpressionMap.get(namedExpression.getExprId());
+            // avoid loop when non_nullable(o_orderkey#0) AS `o_orderkey`#0 
after join eliminate when
+            // inner join

Review Comment:
   Unclear comment: The comment "avoid loop when non_nullable(o_orderkey#0) AS 
`o_orderkey`#0 after join eliminate when inner join" is grammatically incorrect 
and hard to understand. Consider rephrasing to: "Avoid infinite loop when 
handling aliases like non_nullable(o_orderkey#0) AS `o_orderkey`#0 after join 
elimination in inner joins".
   ```suggestion
               // Avoid infinite loop when handling aliases like 
non_nullable(o_orderkey#0) AS `o_orderkey`#0
               // after join elimination in inner joins
   ```



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