The following sql does not work correctly:
CREATE TABLE T(N VARCHAR,I INTEGER)
INSERT INTO T VALUES('a',1)
INSERT INTO T VALUES('a',2)
INSERT INTO T VALUES('b',3)
INSERT INTO T VALUES('b',4)
SELECT N, SUM(I) FROM T GROUP BY N
It returns a single null row.
The bug is in Select.java, getResults() method
if(eCondition==null || eCondition.test()) {
Object row[]=new Object[len];
for(int i=0;i<len;i++) {
row[i]=eColumn[i].getValue();
}
count++;
if(aggregated) {
updateAggregateRow(agg,row,len);
// *** rows are not being added to r at this point
// *** if I comment out the else, it appears to work
// *** } /*else*/ {
// *** I don't know if I'm missing other stuff
} else {
r.add(row);
if(simple_maxrows && count>=maxrows) {
break;
}
}
}
}
Actually, the rows only need here to be added if they are grouped:
replace
} else{
with
} if (grouped) {