private void makeNumberOfRows() {
if (approxRowCount >= 0) {
numberOfRows = approxRowCount;
return;
}
SqlQuery query = getSqlQuery();
query.addSelect("count(*)", null);
query.addFrom(getRelation(), getName(), false);
DataSource dataSource = getAggStar().getStar().getDataSource();
SqlStatement stmt =
RolapUtil.executeQuery(
dataSource,
query.toString(),
new Locus(
new Execution(
star.getSchema().getInternalConnection()
.getInternalStatement(),
0),
"AggStar.FactTable.makeNumberOfRows",
"Counting rows in aggregate table"));
try {
ResultSet resultSet = stmt.getResultSet();
if (resultSet.next()) {
++stmt.rowCount;
numberOfRows = resultSet.getInt(1);
} else {
getLogger().warn(
mres.SqlQueryFailed.str(
"AggStar.FactTable.makeNumberOfRows",
query.toString()));
// set to large number so that this table is never used
numberOfRows = Integer.MAX_VALUE / getTotalColumnSize();
}
} catch (SQLException e) {