-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat low confidence, zero estimations as unknown during joins
- Loading branch information
1 parent
5b1cde7
commit d6f901a
Showing
4 changed files
with
255 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
.../main/java/com/facebook/presto/sql/planner/iterative/LowConfidenceZeroEstimationUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Licensed 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 com.facebook.presto.sql.planner.iterative; | ||
|
||
import com.facebook.presto.sql.planner.iterative.Rule.Context; | ||
import com.facebook.presto.sql.planner.plan.JoinNode; | ||
|
||
import java.util.Optional; | ||
|
||
import static com.facebook.presto.spi.plan.JoinDistributionType.PARTITIONED; | ||
import static com.facebook.presto.spi.plan.JoinDistributionType.REPLICATED; | ||
import static com.facebook.presto.sql.planner.iterative.rule.DetermineJoinDistributionType.isBelowMaxBroadcastSize; | ||
|
||
public class LowConfidenceZeroEstimationUtil | ||
{ | ||
private LowConfidenceZeroEstimationUtil() {}; | ||
|
||
public static Optional<JoinNode> treatLowConfidenceZeroEstimationsAsUnknown(boolean probeSideUnknown, boolean buildSideUnknown, JoinNode joinNode, Context context) | ||
{ | ||
if (buildSideUnknown && probeSideUnknown) { | ||
return Optional.of(joinNode.withDistributionType(PARTITIONED)); | ||
} | ||
else if (buildSideUnknown) { | ||
if (isBelowMaxBroadcastSize(joinNode.flipChildren(), context)) { | ||
return Optional.of(joinNode.flipChildren().withDistributionType(REPLICATED)); | ||
} | ||
else { | ||
return Optional.of(joinNode.withDistributionType(PARTITIONED)); | ||
} | ||
} | ||
else { | ||
if (isBelowMaxBroadcastSize(joinNode, context)) { | ||
return Optional.of(joinNode.withDistributionType(REPLICATED)); | ||
} | ||
else { | ||
return Optional.of(joinNode.withDistributionType(PARTITIONED)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters