morrySnow commented on code in PR #64618: URL: https://github.com/apache/doris/pull/64618#discussion_r3427802923
########## fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/InferSetOperatorDistinctTest.java: ########## @@ -0,0 +1,78 @@ +// 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. + +package org.apache.doris.nereids.rules.rewrite; + +import org.apache.doris.nereids.trees.expressions.NamedExpression; +import org.apache.doris.nereids.trees.expressions.SlotReference; +import org.apache.doris.nereids.trees.plans.Plan; +import org.apache.doris.nereids.trees.plans.RelationId; +import org.apache.doris.nereids.trees.plans.algebra.SetOperation.Qualifier; +import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate; +import org.apache.doris.nereids.trees.plans.logical.LogicalIntersect; +import org.apache.doris.nereids.trees.plans.logical.LogicalOneRowRelation; +import org.apache.doris.nereids.types.IntegerType; +import org.apache.doris.nereids.util.MemoTestUtils; +import org.apache.doris.nereids.util.PlanChecker; +import org.apache.doris.statistics.ColumnStatisticBuilder; +import org.apache.doris.statistics.Statistics; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.List; + +class InferSetOperatorDistinctTest { + + @Test + void testInferDistinctForEachChildByNdv() { Review Comment: **Test coverage concern**: This single test only validates the per-child independent decision for an INTERSECT with one column per child. The deleted regression test (`infer_set_operator_distinct.groovy`) covered 20+ scenarios including: - Different set operation types: UNION, EXCEPT, INTERSECT - Nested set operations (e.g., INTERSECT of EXCEPT of UNION) - Joins with set operations (INNER, LEFT, RIGHT, FULL OUTER, LEFT SEMI) - Complex subqueries with filters - Multi-column scenarios - Hint-based control (`use_INFER_SET_OPERATOR_DISTINCT`, `use_NO_INFER_SET_OPERATOR_DISTINCT`, `/*+ SET_VAR(...) */`) **Suggestions**: 1. Add at least a few more scenarios covering UNION and EXCEPT set operations 2. Add a test for the case where stats derivation falls back (stats is null on the plan) 3. Add a test for a multi-column group key scenario 4. Consider retaining a subset of the regression test for end-to-end validation -- 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]
