[improve](nereids): remove FakeJoin.java (#11946)

This commit is contained in:
jakevin
2022-08-22 08:28:20 +08:00
committed by GitHub
parent adfef85c0c
commit 19496ef9a0
2 changed files with 8 additions and 49 deletions

View File

@ -32,11 +32,11 @@ import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.expressions.SlotReference;
import org.apache.doris.nereids.trees.expressions.functions.AggregateFunction;
import org.apache.doris.nereids.trees.expressions.functions.Sum;
import org.apache.doris.nereids.trees.plans.FakeJoin;
import org.apache.doris.nereids.trees.plans.GroupPlan;
import org.apache.doris.nereids.trees.plans.JoinType;
import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate;
import org.apache.doris.nereids.trees.plans.logical.LogicalFilter;
import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
import org.apache.doris.nereids.trees.plans.logical.LogicalLimit;
import org.apache.doris.nereids.trees.plans.logical.LogicalOlapScan;
import org.apache.doris.nereids.trees.plans.logical.LogicalTopN;
@ -165,9 +165,7 @@ public class StatsCalculatorTest {
@Test
public void testHashJoin() {
List<String> qualifier = new ArrayList<>();
qualifier.add("test");
qualifier.add("t");
List<String> qualifier = ImmutableList.of("test", "t");
SlotReference slot1 = new SlotReference("c1", IntegerType.INSTANCE, true, qualifier);
SlotReference slot2 = new SlotReference("c2", IntegerType.INSTANCE, true, qualifier);
ColumnStats columnStats1 = new ColumnStats();
@ -190,8 +188,12 @@ public class StatsCalculatorTest {
EqualTo equalTo = new EqualTo(slot1, slot2);
FakeJoin fakeSemiJoin = new FakeJoin(JoinType.LEFT_SEMI_JOIN, Optional.of(equalTo));
FakeJoin fakeInnerJoin = new FakeJoin(JoinType.INNER_JOIN, Optional.of(equalTo));
LogicalOlapScan scan1 = PlanConstructor.newLogicalOlapScan(0, "t", 0);
LogicalOlapScan scan2 = PlanConstructor.newLogicalOlapScan(0, "t", 0);
LogicalJoin<LogicalOlapScan, LogicalOlapScan> fakeSemiJoin = new LogicalJoin<>(
JoinType.LEFT_SEMI_JOIN, Optional.of(equalTo), scan1, scan2);
LogicalJoin<LogicalOlapScan, LogicalOlapScan> fakeInnerJoin = new LogicalJoin<>(
JoinType.INNER_JOIN, Optional.of(equalTo), scan1, scan2);
StatsDeriveResult semiJoinStats = JoinEstimation.estimate(leftStats, rightStats, fakeSemiJoin);
Assertions.assertEquals(leftRowCount, semiJoinStats.getRowCount());

View File

@ -1,43 +0,0 @@
// 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.trees.plans;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.plans.algebra.Join;
import java.util.Optional;
public class FakeJoin implements Join {
private final JoinType joinType;
private final Optional<Expression> condition;
public FakeJoin(JoinType joinType, Optional<Expression> condition) {
this.joinType = joinType;
this.condition = condition;
}
@Override
public JoinType getJoinType() {
return joinType;
}
@Override
public Optional<Expression> getCondition() {
return condition;
}
}