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/04/11 09:00:28 UTC

[streampipes] branch fix-parsing-of-count-queries created (now 8a614c14c)

This is an automated email from the ASF dual-hosted git repository.

riemer pushed a change to branch fix-parsing-of-count-queries
in repository https://gitbox.apache.org/repos/asf/streampipes.git


      at 8a614c14c [hotfix] Fix handling of count queries in data explorer

This branch includes the following new commits:

     new 8a614c14c [hotfix] Fix handling of count queries in data explorer

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[streampipes] 01/01: [hotfix] Fix handling of count queries in data explorer

Posted by ri...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch fix-parsing-of-count-queries
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 8a614c14cd36a3efbb3d1e8a0d4fa2fb9bfedf4b
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Tue Apr 11 11:00:03 2023 +0200

    [hotfix] Fix handling of count queries in data explorer
---
 .../dataexplorer/param/model/SelectColumn.java     | 24 ++++++++++++++++++++--
 .../query/DataExplorerQueryExecutor.java           |  3 ++-
 .../widgets/table/table-widget.component.html      |  2 +-
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/param/model/SelectColumn.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/param/model/SelectColumn.java
index fe7be2da4..1fb7661e9 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/param/model/SelectColumn.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/param/model/SelectColumn.java
@@ -67,15 +67,35 @@ public class SelectColumn implements IQueryStatement {
 
   public static SelectColumn fromApiQueryString(String queryString,
                                                 String globalAggregationFunction) {
+    SelectColumn column = SelectColumn.fromApiQueryString(queryString);
     AggregationFunction aggregationFunction = AggregationFunction.valueOf(globalAggregationFunction);
-    String targetField = aggregationFunction.name().toLowerCase() + "_" + queryString;
-    return new SelectColumn(queryString, AggregationFunction.valueOf(globalAggregationFunction), targetField);
+    column.setAggregationFunction(aggregationFunction);
+    column.setTargetField(aggregationFunction.name().toLowerCase() + "_" + column.getOriginalField());
+    column.setRename(true);
+    column.setSimpleField(false);
+    return column;
   }
 
   public String getOriginalField() {
     return originalField;
   }
 
+  public void setAggregationFunction(AggregationFunction aggregationFunction) {
+    this.aggregationFunction = aggregationFunction;
+  }
+
+  public void setTargetField(String targetField) {
+    this.targetField = targetField;
+  }
+
+  public void setSimpleField(boolean simpleField) {
+    this.simpleField = simpleField;
+  }
+
+  public void setRename(boolean rename) {
+    this.rename = rename;
+  }
+
   @Override
   public void buildStatement(IDataLakeQueryBuilder<?> builder) {
     if (this.simpleField) {
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 29d7de50f..f0aecf237 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
@@ -57,7 +57,8 @@ public abstract class DataExplorerQueryExecutor<X, W> {
       X countQuery = makeCountQuery(params);
       W countQueryResult = executeQuery(countQuery);
       var limit = params.getLimit();
-      Double amountOfQueryResults = limit == Integer.MIN_VALUE ? getAmountOfResults(countQueryResult) : limit;
+      var amountOfResults = getAmountOfResults(countQueryResult);
+      Double amountOfQueryResults = limit == Integer.MIN_VALUE ? amountOfResults : Math.min(amountOfResults, limit);
 
       if (amountOfQueryResults > this.maximumAmountOfEvents) {
         SpQueryResult tooMuchData = new SpQueryResult();
diff --git a/ui/src/app/data-explorer/components/widgets/table/table-widget.component.html b/ui/src/app/data-explorer/components/widgets/table/table-widget.component.html
index 1b44a9132..7fcada6fe 100644
--- a/ui/src/app/data-explorer/components/widgets/table/table-widget.component.html
+++ b/ui/src/app/data-explorer/components/widgets/table/table-widget.component.html
@@ -120,7 +120,7 @@
             <tr mat-row *matRowDef="let row; columns: columnNames"></tr>
         </table>
         <mat-paginator
-            *ngIf="showData"
+            color="accent"
             [length]="100"
             [pageSize]="500"
             [pageSizeOptions]="[10, 20, 50, 100, 500, 1000]"