forked from D-Net/dnet-hadoop
avoid to divide by zero: in case of missing values, return undefined response
This commit is contained in:
parent
e3f86b92c8
commit
f2bc665403
|
@ -43,6 +43,10 @@ public class PidMatch extends AbstractCondition {
|
|||
int incommon = Sets.intersection(pidAset, pidBset).size();
|
||||
int simDiff = Sets.symmetricDifference(pidAset, pidBset).size();
|
||||
|
||||
if (incommon + simDiff == 0) {
|
||||
return new ConditionEval(cond, a, b, 0);
|
||||
}
|
||||
|
||||
int result = incommon / (incommon + simDiff) > 0.5 ? 1 : -1;
|
||||
|
||||
return new ConditionEval(cond, a, b, result);
|
||||
|
|
Loading…
Reference in New Issue