Package io.trino.cost
Class PlanNodeStatsEstimateMath
java.lang.Object
io.trino.cost.PlanNodeStatsEstimateMath
-
Method Summary
Modifier and TypeMethodDescriptionstatic PlanNodeStatsEstimatestatic PlanNodeStatsEstimatestatic PlanNodeStatsEstimatestatic PlanNodeStatsEstimatecapStats(PlanNodeStatsEstimate stats, PlanNodeStatsEstimate cap) static doubleestimateCorrelatedConjunctionRowCount(PlanNodeStatsEstimate input, List<PlanNodeStatsEstimate> estimates, double independenceFactor) static doublegetFirstKnownOutputSizeInBytes(PlanNode node, Lookup lookup, StatsProvider statsProvider) Recursively looks for the first source node with a known estimate and uses that to return an approximate output size.static doublegetSourceTablesSizeInBytes(PlanNode node, Lookup lookup, StatsProvider statsProvider) static Map<Symbol, SymbolStatsEstimate> intersectCorrelatedStats(List<PlanNodeStatsEstimate> estimates) static PlanNodeStatsEstimatesubtractSubsetStats(PlanNodeStatsEstimate superset, PlanNodeStatsEstimate subset) Subtracts subset stats from supersets stats.
-
Method Details
-
subtractSubsetStats
public static PlanNodeStatsEstimate subtractSubsetStats(PlanNodeStatsEstimate superset, PlanNodeStatsEstimate subset) Subtracts subset stats from supersets stats. It is assumed that each NDV from subset has a matching NDV in superset. -
capStats
public static PlanNodeStatsEstimate capStats(PlanNodeStatsEstimate stats, PlanNodeStatsEstimate cap) -
getFirstKnownOutputSizeInBytes
public static double getFirstKnownOutputSizeInBytes(PlanNode node, Lookup lookup, StatsProvider statsProvider) Recursively looks for the first source node with a known estimate and uses that to return an approximate output size. Returns NaN if an un-estimated expanding node (Join or Unnest) is encountered. The amount of reduction in size from un-estimated non-expanding nodes (e.g. an un-estimated filter or aggregation) is not accounted here. We make use of the first available estimate and make decision about flipping join sides only if we find a large difference in output size of both sides. -
getSourceTablesSizeInBytes
public static double getSourceTablesSizeInBytes(PlanNode node, Lookup lookup, StatsProvider statsProvider) -
addStatsAndSumDistinctValues
public static PlanNodeStatsEstimate addStatsAndSumDistinctValues(PlanNodeStatsEstimate left, PlanNodeStatsEstimate right) -
addStatsAndMaxDistinctValues
public static PlanNodeStatsEstimate addStatsAndMaxDistinctValues(PlanNodeStatsEstimate left, PlanNodeStatsEstimate right) -
addStatsAndCollapseDistinctValues
public static PlanNodeStatsEstimate addStatsAndCollapseDistinctValues(PlanNodeStatsEstimate left, PlanNodeStatsEstimate right)
-