private static int compare(WindowNode o1, WindowNode o2) { int comparison = comparePartitionBy(o1, o2); if (comparison != 0) { return comparison; } comparison = compareOrderBy(o1, o2); if (comparison != 0) { return comparison; } // If PartitionBy and OrderBy clauses are identical, let's establish an arbitrary order to prevent non-deterministic results of swapping WindowNodes in such a case return o1.getId().toString().compareTo(o2.getId().toString()); }
private static int compare(WindowNode o1, WindowNode o2) { int comparison = comparePartitionBy(o1, o2); if (comparison != 0) { return comparison; } comparison = compareOrderBy(o1, o2); if (comparison != 0) { return comparison; } // If PartitionBy and OrderBy clauses are identical, let's establish an arbitrary order to prevent non-deterministic results of swapping WindowNodes in such a case return o1.getId().toString().compareTo(o2.getId().toString()); }
private StatsCalculator statsCalculator(Map<String, PlanNodeStatsEstimate> stats) { return (node, sourceStats, lookup, session, types) -> requireNonNull(stats.get(node.getId().toString()), "no stats for node"); }
private StatsCalculator statsCalculator(Map<String, PlanNodeStatsEstimate> stats) { return (node, sourceStats, lookup, session, types) -> requireNonNull(stats.get(node.getId().toString()), "no stats for node"); }
private CostAssertionBuilder assertCost( CostCalculator costCalculator, PlanNode node, Map<String, PlanNodeCostEstimate> costs, Map<String, PlanNodeStatsEstimate> stats, Map<String, Type> types) { PlanNodeCostEstimate cumulativeCost = calculateCumulativeCost( costCalculator, node, planNode -> costs.get(planNode.getId().toString()), planNode -> stats.get(planNode.getId().toString()), types); return new CostAssertionBuilder(cumulativeCost); }
private CostAssertionBuilder assertCost( CostCalculator costCalculator, PlanNode node, Map<String, PlanNodeCostEstimate> costs, Map<String, PlanNodeStatsEstimate> stats, Map<String, Type> types) { PlanNodeCostEstimate cumulativeCost = calculateCumulativeCost( costCalculator, node, planNode -> costs.get(planNode.getId().toString()), planNode -> stats.get(planNode.getId().toString()), types); return new CostAssertionBuilder(cumulativeCost); }