dynamobi/dynamobi — Issue #160: [LDB-162] fix reference comparison problem reported by findbugs in index optimization
Author: dynamobi-build
Created: 2011-12-30 02:17:35+00:00
State: open
Labels: LDB, Optimizer

[reporter="jvs", created="Fri, 18 May 2007 17:12:32 -0500 (GMT-05:00)"]
(can't use == on Double, since that compares object identity rather than value)

//open/lu/dev/farrago/src/com/lucidera/lcs/LcsIndexOptimizer.java

public int compare(SargColumnFilter filter1, SargColumnFilter filter2)

{

// sort based on the selectivity if stats are available; otherwise,

// just sort on column number to ensure that results are

// deterministic

Double colSel1 = filter1.getSelectivity(tabStats);

Double colSel2 = filter2.getSelectivity(tabStats);

if (colSel1 != null && colSel2 != null) {

return

(colSel1 < colSel2) ? -1 :

((colSel1 == colSel2) ? 0 : 1);

} else {

return (filter1.columnPos - filter2.columnPos);

}

}

}