public CellDataSet getFormattedResult(String query, @NotNull String format) throws Exception {
QueryContext qc = getContext(query);
ThinQuery tq = qc.getOlapQuery();
CellSet cs = qc.getOlapResult();
String formatterName = StringUtils.isBlank(format) ? "" : format.toLowerCase();
ICellSetFormatter cf = cff.forName(formatterName);
CellDataSet result = OlapResultSetUtil.cellSet2Matrix(cs, cf);
if (ThinQuery.Type.QUERYMODEL.equals(tq.getType()) && cf instanceof FlattenedCellSetFormatter && tq
.hasAggregators()) {
calculateTotals(tq, result, cs, cf);