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/02/11 21:07:41 UTC

[streampipes] branch dev updated: [hotfix] Fix query result response after database uppgrade

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

riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new 649f666a2 [hotfix] Fix query result response after database uppgrade
649f666a2 is described below

commit 649f666a23cf2e36a3332efd7b77f08d04a4ffb8
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Sat Feb 11 22:07:31 2023 +0100

    [hotfix] Fix query result response after database uppgrade
---
 .../streampipes/dataexplorer/v4/query/DataExplorerQueryV4.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/DataExplorerQueryV4.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/DataExplorerQueryV4.java
index 05d4f7987..5bb56b375 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/DataExplorerQueryV4.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/DataExplorerQueryV4.java
@@ -169,7 +169,7 @@ public class DataExplorerQueryV4 {
                                     boolean ignoreMissingValues) throws RuntimeException {
     SpQueryResult result = new SpQueryResult();
 
-    if (queryResult.getResults().get(0).getSeries() != null) {
+    if (hasResult(queryResult)) {
       result.setTotal(queryResult.getResults().get(0).getSeries().size());
       queryResult.getResults().get(0).getSeries().forEach(rs -> {
         DataSeries series = convertResult(rs, ignoreMissingValues);
@@ -185,6 +185,12 @@ public class DataExplorerQueryV4 {
     return result;
   }
 
+  private boolean hasResult(QueryResult queryResult) {
+    return queryResult.getResults() != null
+        && queryResult.getResults().size() > 0
+        && queryResult.getResults().get(0).getSeries() != null;
+  }
+
   protected List<QueryElement<?>> getQueryElements() {
     List<QueryElement<?>> queryElements = new ArrayList<>();