Skip to content

Commit

Permalink
Use max of the inputs for distinct value cardinality estimation in
Browse files Browse the repository at this point in the history
UnionNode
  • Loading branch information
Matthias Ringwald committed Jul 16, 2012
1 parent 832c49c commit a937895
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public void computeOutputEstimates(DataStatistics statistics) {
// init estimated cardinalities with the fields of the first input
// remove the field which are unknown for other inputs later on
for (FieldSet fieldSet : inConns.get(0).getSourcePact().getEstimatedCardinalities().keySet()) {
this.estimatedCardinality.put(fieldSet, 0L);
this.estimatedCardinality.put(fieldSet, -1L);
}


Expand Down Expand Up @@ -366,8 +366,8 @@ public void computeOutputEstimates(DataStatistics statistics) {
toRemove.add(cardinality.getKey());
}
else {
//to be conservative we assume the inputs are disjoint
inputCard += cardinality.getValue();
//to be conservative for joins we use the max for new column cardinality
inputCard = Math.max(inputCard, cardinality.getValue());
cardinality.setValue(inputCard);
}
}
Expand Down

0 comments on commit a937895

Please sign in to comment.