From 26279bb4c6d5b10ec554cfb50f5bc806ed6e4470 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Fri, 13 Jan 2023 19:30:53 +0100 Subject: [PATCH] add error message when more than 100 groups are found --- .../java/org/lucares/performance/db/PerformanceDb.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/performanceDb/src/main/java/org/lucares/performance/db/PerformanceDb.java b/performanceDb/src/main/java/org/lucares/performance/db/PerformanceDb.java index e52418a..1320dab 100644 --- a/performanceDb/src/main/java/org/lucares/performance/db/PerformanceDb.java +++ b/performanceDb/src/main/java/org/lucares/performance/db/PerformanceDb.java @@ -183,6 +183,14 @@ public class PerformanceDb implements AutoCloseable { 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); METRICS_LOGGER.debug("query execution took: " + (System.nanoTime() - start) / 1_000_000.0 + "ms: " + query + " (" + groupBy + "): files found: " + pdbFiles.size());