You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2023/12/12 10:07:20 UTC
(streampipes) branch 2313-improve-performance-of-data-explorer-queries updated: feat(#2313): Remove count query from data explorer queries
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch 2313-improve-performance-of-data-explorer-queries
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/2313-improve-performance-of-data-explorer-queries by this push:
new 1525accdc feat(#2313): Remove count query from data explorer queries
1525accdc is described below
commit 1525accdcf3bc9a670820456259d37b43b003114
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Tue Dec 12 11:06:48 2023 +0100
feat(#2313): Remove count query from data explorer queries
---
.../dataexplorer/query/DataExplorerQueryExecutor.java | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/DataExplorerQueryExecutor.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/DataExplorerQueryExecutor.java
index f0aecf237..c7b96f473 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/DataExplorerQueryExecutor.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/DataExplorerQueryExecutor.java
@@ -21,6 +21,7 @@ package org.apache.streampipes.dataexplorer.query;
import org.apache.streampipes.dataexplorer.influx.DataExplorerInfluxQueryExecutor;
import org.apache.streampipes.dataexplorer.param.DeleteQueryParams;
import org.apache.streampipes.dataexplorer.param.SelectQueryParams;
+import org.apache.streampipes.model.datalake.DataSeries;
import org.apache.streampipes.model.datalake.SpQueryResult;
import org.apache.streampipes.model.datalake.SpQueryStatus;
@@ -53,23 +54,23 @@ public abstract class DataExplorerQueryExecutor<X, W> {
public SpQueryResult executeQuery(SelectQueryParams params,
boolean ignoreMissingValues) throws RuntimeException {
+ X query = makeSelectQuery(params);
+ var result = executeQuery(query, ignoreMissingValues);
if (this.maximumAmountOfEvents != -1) {
- X countQuery = makeCountQuery(params);
- W countQueryResult = executeQuery(countQuery);
var limit = params.getLimit();
- var amountOfResults = getAmountOfResults(countQueryResult);
- Double amountOfQueryResults = limit == Integer.MIN_VALUE ? amountOfResults : Math.min(amountOfResults, limit);
-
+ var amountOfResults = result.getAllDataSeries().stream().mapToInt(DataSeries::getTotal).sum();
+ var amountOfQueryResults = limit == Integer.MIN_VALUE ? amountOfResults : Math.min(amountOfResults, limit);
if (amountOfQueryResults > this.maximumAmountOfEvents) {
SpQueryResult tooMuchData = new SpQueryResult();
tooMuchData.setSpQueryStatus(SpQueryStatus.TOO_MUCH_DATA);
- tooMuchData.setTotal(amountOfQueryResults.intValue());
+ tooMuchData.setTotal(amountOfQueryResults);
return tooMuchData;
+ } else {
+ return result;
}
+ } else {
+ return result;
}
-
- X query = makeSelectQuery(params);
- return executeQuery(query, ignoreMissingValues);
}
public SpQueryResult executeQuery(DeleteQueryParams params) {