add error message when more than 100 groups are found

This commit is contained in:
2023-01-13 19:30:53 +01:00
parent e996a40447
commit 26279bb4c6

View File

@@ -183,6 +183,14 @@ 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());