fix limit by does not work anymore

This commit is contained in:
2023-01-13 19:38:27 +01:00
parent 26279bb4c6
commit 760a6dd60e
2 changed files with 6 additions and 8 deletions

View File

@@ -76,6 +76,12 @@ public class Plotter {
final Result result = db.get(new Query(query, dateRange), groupBy); final Result result = db.get(new Query(query, dateRange), groupBy);
if (result.getGroups().size() > 100 && plotSettings.getLimitBy() == Limit.NO_LIMIT) {
throw new RuntimeException("too many groups - try adding restrictions for one of these fields "
+ String.join(",", groupBy) + ".For example '" + query + " and " + groupBy.get(0)
+ "=someValue'. Or you can remove a field from 'Group By'.");
}
final long start = System.nanoTime(); final long start = System.nanoTime();
final AtomicInteger idCounter = new AtomicInteger(0); final AtomicInteger idCounter = new AtomicInteger(0);
result.getGroups().stream().parallel().forEach(groupResult -> { result.getGroups().stream().parallel().forEach(groupResult -> {

View File

@@ -183,14 +183,6 @@ public class PerformanceDb implements AutoCloseable {
final Grouping grouping = Grouping.groupBy(pdbFiles, groupBy); final Grouping grouping = Grouping.groupBy(pdbFiles, groupBy);
if (grouping.getGroups().size() > 100) {
// we know groupBy is not empty, because we have groupings
final String example = " For example '" + query.getQuery() + " and " + groupBy.get(0) + "=someValue'";
throw new RuntimeException("too many groups - try adding restrictions for one of these fields "
+ String.join(",", groupBy) + "." + example + " Or you can remove a field from 'Group By'.");
}
final Result result = toResult(grouping); final Result result = toResult(grouping);
METRICS_LOGGER.debug("query execution took: " + (System.nanoTime() - start) / 1_000_000.0 + "ms: " + query METRICS_LOGGER.debug("query execution took: " + (System.nanoTime() - start) / 1_000_000.0 + "ms: " + query
+ " (" + groupBy + "): files found: " + pdbFiles.size()); + " (" + groupBy + "): files found: " + pdbFiles.size());