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 2022/11/30 09:46:40 UTC
[streampipes] branch dev updated: [hotfix] Add offset to query builder
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 b388991e6 [hotfix] Add offset to query builder
b388991e6 is described below
commit b388991e615de9a24fd517dba1dda9a636e15939
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Wed Nov 30 10:46:31 2022 +0100
[hotfix] Add offset to query builder
---
.../streampipes/dataexplorer/sdk/DataLakeQueryBuilder.java | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/sdk/DataLakeQueryBuilder.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/sdk/DataLakeQueryBuilder.java
index de399b3cc..54ba84e12 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/sdk/DataLakeQueryBuilder.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/sdk/DataLakeQueryBuilder.java
@@ -38,6 +38,7 @@ public class DataLakeQueryBuilder {
private final List<Clause> groupByClauses;
private Ordering ordering;
private int limit = Integer.MIN_VALUE;
+ private int offset = Integer.MIN_VALUE;
public static DataLakeQueryBuilder create(String measurementId) {
return new DataLakeQueryBuilder(measurementId);
@@ -166,6 +167,12 @@ public class DataLakeQueryBuilder {
return this;
}
+ public DataLakeQueryBuilder withOffset(int offset) {
+ this.offset = offset;
+
+ return this;
+ }
+
public Query build() {
var selectQuery = this.selectionQuery.from(BackendConfig.INSTANCE.getInfluxDatabaseName(), "\"" +measurementId + "\"");
this.whereClauses.forEach(selectQuery::where);
@@ -182,6 +189,10 @@ public class DataLakeQueryBuilder {
selectQuery.limit(this.limit);
}
+ if (this.offset > 0) {
+ selectQuery.limit(this.limit, this.offset);
+ }
+
return selectQuery;
}
}