morrySnow commented on code in PR #12858: URL: https://github.com/apache/doris/pull/12858#discussion_r982320377
########## fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostEstimate.java: ########## @@ -88,13 +86,17 @@ public static CostEstimate ofMemory(double memoryCost) { } /** - * Sums partial cost estimates of some (single) plan node. + * sum of cost estimate */ public static CostEstimate sum(CostEstimate one, CostEstimate two, CostEstimate... more) { - return Stream.concat(Stream.of(one, two), Stream.of(more)) - .reduce(zero(), (a, b) -> new CostEstimate( - a.cpuCost + b.cpuCost, - a.memoryCost + b.memoryCost, - a.networkCost + b.networkCost)); + double v1 = one.cpuCost + two.cpuCost; + double v2 = one.memoryCost + two.memoryCost; + double v3 = one.networkCost + one.networkCost; Review Comment: use meaningful variable names ########## fe/fe-core/src/main/java/org/apache/doris/nereids/properties/RequestPropertyDeriver.java: ########## @@ -69,11 +69,11 @@ public List<List<PhysicalProperties>> getRequestChildrenPropertyList(GroupExpres @Override public Void visit(Plan plan, PlanContext context) { - List<PhysicalProperties> requiredPropertyList = Lists.newArrayList(); - for (int i = 0; i < context.getGroupExpression().arity(); i++) { - requiredPropertyList.add(PhysicalProperties.ANY); + List<PhysicalProperties> nCopyList = Lists.newArrayListWithCapacity(context.getGroupExpression().arity()); + for (int i = context.getGroupExpression().arity(); i > 0; --i) { Review Comment: why use -- ? ########## fe/fe-core/src/main/java/org/apache/doris/nereids/util/JoinUtils.java: ########## @@ -68,16 +68,17 @@ private static class JoinSlotCoverageChecker { rightExprIds = right.stream().map(Slot::getExprId).collect(Collectors.toSet()); } - boolean isCoveredByLeftSlots(Set<Slot> slots) { - return slots.stream() - .map(Slot::getExprId) - .allMatch(leftExprIds::contains); + JoinSlotCoverageChecker(Set<ExprId> left, Set<ExprId> right) { + leftExprIds = left; + rightExprIds = right; } - boolean isCoveredByRightSlots(Set<Slot> slots) { - return slots.stream() - .map(Slot::getExprId) - .allMatch(rightExprIds::contains); + boolean isCoveredByLeftSlots(ExprId slot) { Review Comment: add comment to explain why only one slot is enough ########## fe/fe-core/src/main/java/org/apache/doris/nereids/util/JoinUtils.java: ########## @@ -152,37 +154,35 @@ public static Pair<List<Expression>, List<Expression>> extractExpressionForHashT */ public static Pair<List<ExprId>, List<ExprId>> getOnClauseUsedSlots( Review Comment: make sure these functions has enough unit test. ########## fe/fe-core/src/main/java/org/apache/doris/nereids/properties/RequestPropertyDeriver.java: ########## @@ -69,11 +69,11 @@ public List<List<PhysicalProperties>> getRequestChildrenPropertyList(GroupExpres @Override public Void visit(Plan plan, PlanContext context) { - List<PhysicalProperties> requiredPropertyList = Lists.newArrayList(); - for (int i = 0; i < context.getGroupExpression().arity(); i++) { - requiredPropertyList.add(PhysicalProperties.ANY); + List<PhysicalProperties> nCopyList = Lists.newArrayListWithCapacity(context.getGroupExpression().arity()); Review Comment: why rename it? ########## fe/fe-core/src/main/java/org/apache/doris/nereids/properties/DistributionSpecHash.java: ########## @@ -208,16 +214,18 @@ public boolean equals(Object o) { return false; } DistributionSpecHash that = (DistributionSpecHash) o; - return tableId == that.tableId && orderedShuffledColumns.equals(that.orderedShuffledColumns) - && shuffleType == that.shuffleType && partitionIds.equals(that.partitionIds) - && equivalenceExprIds.equals(that.equivalenceExprIds) - && exprIdToEquivalenceSet.equals(that.exprIdToEquivalenceSet); + return shuffleType == that.shuffleType && orderedShuffledColumns.equals(that.orderedShuffledColumns); + // return tableId == that.tableId && orderedShuffledColumns.equals(that.orderedShuffledColumns) + // && shuffleType == that.shuffleType && partitionIds.equals(that.partitionIds) + // && equivalenceExprIds.equals(that.equivalenceExprIds) + // && exprIdToEquivalenceSet.equals(that.exprIdToEquivalenceSet); } @Override public int hashCode() { - return Objects.hash(orderedShuffledColumns, shuffleType, tableId, partitionIds, - equivalenceExprIds, exprIdToEquivalenceSet); + // return Objects.hash(orderedShuffledColumns, shuffleType, tableId, partitionIds, + // equivalenceExprIds, exprIdToEquivalenceSet); Review Comment: ditto ########## fe/fe-core/src/main/java/org/apache/doris/nereids/properties/DistributionSpecHash.java: ########## @@ -208,16 +214,18 @@ public boolean equals(Object o) { return false; } DistributionSpecHash that = (DistributionSpecHash) o; - return tableId == that.tableId && orderedShuffledColumns.equals(that.orderedShuffledColumns) - && shuffleType == that.shuffleType && partitionIds.equals(that.partitionIds) - && equivalenceExprIds.equals(that.equivalenceExprIds) - && exprIdToEquivalenceSet.equals(that.exprIdToEquivalenceSet); + return shuffleType == that.shuffleType && orderedShuffledColumns.equals(that.orderedShuffledColumns); + // return tableId == that.tableId && orderedShuffledColumns.equals(that.orderedShuffledColumns) + // && shuffleType == that.shuffleType && partitionIds.equals(that.partitionIds) + // && equivalenceExprIds.equals(that.equivalenceExprIds) + // && exprIdToEquivalenceSet.equals(that.exprIdToEquivalenceSet); Review Comment: remove it -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org