Search in sources :

Example 1 with JoinDistributionType

use of io.prestosql.sql.analyzer.FeaturesConfig.JoinDistributionType in project hetu-core by openlookeng.

the class DetermineJoinDistributionType method canReplicate.

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

Aggregations

DataSize (io.airlift.units.DataSize)1 SystemSessionProperties.getJoinDistributionType (io.prestosql.SystemSessionProperties.getJoinDistributionType)1 PlanNodeStatsEstimate (io.prestosql.cost.PlanNodeStatsEstimate)1 PlanNode (io.prestosql.spi.plan.PlanNode)1 JoinDistributionType (io.prestosql.sql.analyzer.FeaturesConfig.JoinDistributionType)1