From 760a6dd60ed1cca28e049d53e13aa736c1bf5547 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Fri, 13 Jan 2023 19:38:27 +0100 Subject: [PATCH] fix limit by does not work anymore --- .../src/main/java/org/lucares/recommind/logs/Plotter.java | 6 ++++++ .../java/org/lucares/performance/db/PerformanceDb.java | 8 -------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pdb-plotting/src/main/java/org/lucares/recommind/logs/Plotter.java b/pdb-plotting/src/main/java/org/lucares/recommind/logs/Plotter.java index 8a8c05d..02bd094 100644 --- a/pdb-plotting/src/main/java/org/lucares/recommind/logs/Plotter.java +++ b/pdb-plotting/src/main/java/org/lucares/recommind/logs/Plotter.java @@ -76,6 +76,12 @@ public class Plotter { 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 AtomicInteger idCounter = new AtomicInteger(0); result.getGroups().stream().parallel().forEach(groupResult -> { 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 1320dab..e52418a 100644 --- a/performanceDb/src/main/java/org/lucares/performance/db/PerformanceDb.java +++ b/performanceDb/src/main/java/org/lucares/performance/db/PerformanceDb.java @@ -183,14 +183,6 @@ 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());