You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by fj...@apache.org on 2020/09/25 10:56:10 UTC

[incubator-streampipes] branch datalake-rest-extension updated: Clean Up

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

fjohn pushed a commit to branch datalake-rest-extension
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


The following commit(s) were added to refs/heads/datalake-rest-extension by this push:
     new 886b08f  Clean Up
886b08f is described below

commit 886b08fed4c0ec054520435a1b4e9f5785aaf96a
Author: Felix John <jo...@axantu.com>
AuthorDate: Fri Sep 25 12:55:56 2020 +0200

    Clean Up
---
 .../streampipes/rest/impl/datalake/DataLakeManagementV3.java     | 9 ++++-----
 .../streampipes/rest/impl/datalake/DataLakeResourceV3.java       | 6 +++---
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeManagementV3.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeManagementV3.java
index 5a99e0f..f85c747 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeManagementV3.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeManagementV3.java
@@ -141,6 +141,7 @@ public class DataLakeManagementV3 {
 
   public DataResult getEventsAutoAggregation(String index, long startDate, long endDate, @Nullable String rp)
           throws ParseException {
+
     InfluxDB influxDB = getInfluxDBClient();
     double numberOfRecords = getNumOfRecordsOfTable(index, influxDB, startDate, endDate, rp);
     influxDB.close();
@@ -253,16 +254,16 @@ public class DataLakeManagementV3 {
     return new PageResult(dataResult.getTotal(), dataResult.getHeaders(), dataResult.getRows(), page, pageSum);
   }
 
-  public void writeMeasurementFromDefaulToCustomRententionPolicy(String index, String rp) {
+  public void assignMeasurementFromDefaulToCustomRententionPolicy(String index, String rp) {
     InfluxDB influxDB = getInfluxDBClient();
     String rp_default = BackendConfig.INSTANCE.getDefaultRetentionPolicyName();
 
-    QueryResult result = influxDB.query(new Query("SELECT * INTO " +
+    influxDB.query(new Query("SELECT * INTO " +
             BackendConfig.INSTANCE.getInfluxDatabaseName() + "." + rp + "." + index + "_temp"
             + " FROM " + BackendConfig.INSTANCE.getInfluxDatabaseName() + "." + rp_default + "." + index));
     deleteMeasurement(index);
 
-    QueryResult result_2 = influxDB.query(new Query("SELECT * INTO " +
+    influxDB.query(new Query("SELECT * INTO " +
             BackendConfig.INSTANCE.getInfluxDatabaseName() + "." + rp + "." + index
             + " FROM " + BackendConfig.INSTANCE.getInfluxDatabaseName() + "." + rp + "." + index + "_temp"));
     deleteMeasurement(index + "_temp");
@@ -689,7 +690,6 @@ public class DataLakeManagementV3 {
     double numOfRecords = 0;
 
     if (rp == null) rp = BackendConfig.INSTANCE.getDefaultRetentionPolicyName();
-
     QueryResult.Result result = influxDB.query(new Query("SELECT count(*) FROM "
             + BackendConfig.INSTANCE.getInfluxDatabaseName() + "." + rp + "." + index +
             " WHERE time > " + startDate * 1000000 + " AND time < " + endDate * 1000000,
@@ -712,7 +712,6 @@ public class DataLakeManagementV3 {
     double numOfRecords = 0;
 
     if (rp == null) rp = BackendConfig.INSTANCE.getDefaultRetentionPolicyName();
-
     QueryResult.Result result = influxDB.query(new Query("SELECT count(*) FROM "
             + BackendConfig.INSTANCE.getInfluxDatabaseName() + "." + rp + "." + index +
             " WHERE time > now() -" + value + timeunit,
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
index 0f11b7f..fc29986 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
@@ -278,10 +278,10 @@ public class DataLakeResourceV3 extends AbstractRestInterface {
   @GET
   @Path("/data/{index}/default/{name}")
   @Produces(MediaType.TEXT_PLAIN)
-  public Response writeMeasurementFromDefaulToCustomRententionPolicy(@PathParam("index") String index,
+  public Response assignMeasurementFromDefaulToCustomRententionPolicy(@PathParam("index") String index,
           @PathParam("name") String policyRetentionName) {
-      this.dataLakeManagement.writeMeasurementFromDefaulToCustomRententionPolicy(index, policyRetentionName);
-      return Response.ok("Wrote measurement to other retention policy.", MediaType.TEXT_PLAIN).build();
+      this.dataLakeManagement.assignMeasurementFromDefaulToCustomRententionPolicy(index, policyRetentionName);
+      return Response.ok("Assigned measurement to other retention policy.", MediaType.TEXT_PLAIN).build();
   }
 
   @GET