Search in sources :

Example 1 with JoinDistributionType

use of io.trino.sql.planner.OptimizerConfig.JoinDistributionType in project trino by trinodb.

the class DetermineJoinDistributionType method canReplicate.

public static boolean canReplicate(JoinNode joinNode, Context context) {
    JoinDistributionType joinDistributionType = getJoinDistributionType(context.getSession());
    if (!joinDistributionType.canReplicate()) {
        return false;
    }
    DataSize joinMaxBroadcastTableSize = getJoinMaxBroadcastTableSize(context.getSession());
    PlanNode buildSide = joinNode.getRight();
    PlanNodeStatsEstimate buildSideStatsEstimate = context.getStatsProvider().getStats(buildSide);
    double buildSideSizeInBytes = buildSideStatsEstimate.getOutputSizeInBytes(buildSide.getOutputSymbols(), context.getSymbolAllocator().getTypes());
    return buildSideSizeInBytes <= joinMaxBroadcastTableSize.toBytes() || getSourceTablesSizeInBytes(buildSide, context) <= joinMaxBroadcastTableSize.toBytes();
}
Also used : PlanNode(io.trino.sql.planner.plan.PlanNode) JoinDistributionType(io.trino.sql.planner.OptimizerConfig.JoinDistributionType) SystemSessionProperties.getJoinDistributionType(io.trino.SystemSessionProperties.getJoinDistributionType) PlanNodeStatsEstimate(io.trino.cost.PlanNodeStatsEstimate) DataSize(io.airlift.units.DataSize)

Aggregations

DataSize (io.airlift.units.DataSize)1 SystemSessionProperties.getJoinDistributionType (io.trino.SystemSessionProperties.getJoinDistributionType)1 PlanNodeStatsEstimate (io.trino.cost.PlanNodeStatsEstimate)1 JoinDistributionType (io.trino.sql.planner.OptimizerConfig.JoinDistributionType)1 PlanNode (io.trino.sql.planner.plan.PlanNode)1