query.setHblParameter(2, startTime);
query.setHblParameter(3, endTime);
query.setHblParameter(4, i);
AggregateResultSet rs = query.execute();
closeables.addFirst(rs);
while (rs.hasNext()) {
rs.next();
PreparedAggregateResult ar = (PreparedAggregateResult) rs.current();
OnlineCannyAvgSummarizer ctrSum = (OnlineCannyAvgSummarizer) ar.getObject("ctr");
Double wctr = ctrSum == null ? null : ctrSum.getValue();
// sum has semantics of being NULL for sum of all NULLs
Double impSum = (Double) ar.getObject("impSum");
if (impSum == null)
impSum = new Double(0);
Double clickSum = (Double) ar.getObject("clickSum");
if (clickSum == null)
clickSum = new Double(0);
System.out
.printf("%032X (charDim=%s) sum/cnt: impCnt %.4f/%d, click %.4f/%d, ctr: %.4f, weighted ctr: %.4f \n",
new BigInteger(1, (byte[]) ar.getObject(0)),
ar.getObject("charDim1"),
ar.getObject("impSum"),
ar.getObject("impCnt"),
ar.getObject("clickSum"),
ar.getObject("clickCnt"),
clickSum / impSum,
wctr);
}
closeables.remove(rs);
rs.close();
System.out.printf("query+printout complete in %d ms\n", System.currentTimeMillis() - ms);
}
} finally {