Skip to content

Commit

Permalink
[fix](Nereids): fix choose id when there is enforcer in group (apache…
Browse files Browse the repository at this point in the history
  • Loading branch information
keanji-x authored May 10, 2024
1 parent 673c61a commit 9da0233
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class Group {

private PhysicalProperties chosenProperties;

private int chosenGroupExpressionId = -1;
private List<Integer> chosenGroupExpressionId = new ArrayList<>();

private StructInfoMap structInfoMap = new StructInfoMap();

Expand Down Expand Up @@ -215,13 +215,13 @@ public double getCostLowerBound() {
public Optional<Pair<Cost, GroupExpression>> getLowestCostPlan(PhysicalProperties physicalProperties) {
chosenProperties = physicalProperties;
if (physicalProperties == null || lowestCostPlans.isEmpty()) {
chosenGroupExpressionId = -1;
chosenGroupExpressionId.clear();
return Optional.empty();
}
Optional<Pair<Cost, GroupExpression>> costAndGroupExpression =
Optional.ofNullable(lowestCostPlans.get(physicalProperties));
if (costAndGroupExpression.isPresent()) {
chosenGroupExpressionId = costAndGroupExpression.get().second.getId().asInt();
chosenGroupExpressionId.add(costAndGroupExpression.get().second.getId().asInt());
}
return costAndGroupExpression;
}
Expand Down Expand Up @@ -463,7 +463,7 @@ public String toString() {
for (GroupExpression enforcer : enforcers) {
str.append(" ").append(enforcer).append("\n");
}
if (chosenGroupExpressionId != -1) {
if (!chosenGroupExpressionId.isEmpty()) {
str.append(" chosen expression id: ").append(chosenGroupExpressionId).append("\n");
str.append(" chosen properties: ").append(chosenProperties).append("\n");
}
Expand Down

0 comments on commit 9da0233

Please sign in to comment.