morrySnow commented on code in PR #64618: URL: https://github.com/apache/doris/pull/64618#discussion_r3457574382
########## 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 gap**: This single test validates only one scenario: INTERSECT with one column per child, where the left child has low NDV (10) and the right child has high NDV (950). The deleted regression test (`infer_set_operator_distinct.groovy` + `.out`, 363 lines) covered 20+ scenarios including: - Different set operation types: UNION, EXCEPT, INTERSECT - Nested set operations - Join + set operation combinations (INNER, LEFT, RIGHT, FULL OUTER, LEFT SEMI) - Complex subqueries with filters - Multi-column group keys - Hint-based control Please add at least: 1. A UNION test case (most common set operation) 2. A multi-column group key scenario 3. An edge case where no child qualifies for distinct inference (to test the `!hasNewChildren` -> `return null` path) -- 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]
