You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ji...@apache.org on 2019/04/16 22:33:00 UTC

[incubator-pinot] branch master updated: [TE] Fix the dimension values that contain dot in it (#4125)

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

jihao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 24c7a8e  [TE] Fix the dimension values that contain dot in it (#4125)
24c7a8e is described below

commit 24c7a8e5106676f847976da5a0e211c1516805ed
Author: Jihao Zhang <ji...@linkedin.com>
AuthorDate: Tue Apr 16 15:32:55 2019 -0700

    [TE] Fix the dimension values that contain dot in it (#4125)
    
    - If there is a dot in a dimension value, it won't be able to show up correctly in the RCA page. This also affects the time series fetching cause it's querying a wrong dimension name. This is caused by a hack to parse the timestamps that contain a dot in the SQL result. This PR removes this hack and resolves the issue. The timestamp parsing should be configured in the data set time stamp format instead.
    
    - Add static final constants to decrease memory footprint.
---
 .../pinot/thirdeye/datasource/pinot/PinotThirdEyeDataSource.java    | 3 ++-
 .../thirdeye/datasource/pinot/resultset/ThirdEyeResultSetUtils.java | 6 ++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/PinotThirdEyeDataSource.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/PinotThirdEyeDataSource.java
index 6d71bea..3468425 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/PinotThirdEyeDataSource.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/PinotThirdEyeDataSource.java
@@ -62,6 +62,7 @@ public class PinotThirdEyeDataSource implements ThirdEyeDataSource {
   private static final Logger LOG = LoggerFactory.getLogger(PinotThirdEyeDataSource.class);
   private static final ThirdEyeCacheRegistry CACHE_REGISTRY_INSTANCE = ThirdEyeCacheRegistry.getInstance();
   public static final String DATA_SOURCE_NAME = PinotThirdEyeDataSource.class.getSimpleName();
+  private static final String PINOT = "Pinot";
 
   private static final long CONNECTION_TIMEOUT = 60000;
 
@@ -199,7 +200,7 @@ public class PinotThirdEyeDataSource implements ThirdEyeDataSource {
       }
 
       List<String[]> resultRows = ThirdEyeResultSetUtils.parseResultSets(request, metricFunctionToResultSetList,
-          "Pinot");
+          PINOT);
       return new RelationalThirdEyeResponse(request, resultRows, timeSpec);
 
     } catch (Exception e) {
diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/resultset/ThirdEyeResultSetUtils.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/resultset/ThirdEyeResultSetUtils.java
index eb18e6b..e164489 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/resultset/ThirdEyeResultSetUtils.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/resultset/ThirdEyeResultSetUtils.java
@@ -47,6 +47,7 @@ public class ThirdEyeResultSetUtils {
   private static final Logger LOG = LoggerFactory.getLogger(ThirdEyeResultSetUtils.class);
   private static final String MYSQL = "MySQL";
   private static final String H2 = "H2";
+  private static final String PINOT = "Pinot";
 
   public static List<String[]> parseResultSets(ThirdEyeRequest request,
       Map<MetricFunction, List<ThirdEyeResultSet>> metricFunctionToResultSetList,
@@ -111,9 +112,6 @@ public class ThirdEyeResultSetUtils {
               String groupKeyVal = "";
               try {
                 groupKeyVal = resultSet.getGroupKeyColumnValue(r, grpKeyIdx);
-                if (groupKeyVal.indexOf('.') > 0) {
-                  groupKeyVal = groupKeyVal.substring(0, groupKeyVal.indexOf('.'));
-                }
               } catch (Exception e) {
                 // IGNORE FOR NOW, workaround for Pinot Bug
               }
@@ -190,7 +188,7 @@ public class ThirdEyeResultSetUtils {
       return (aggregate * prevCount + value) / (prevCount + 1);
     } else if (aggFunction.equals(MetricAggFunction.MAX)) {
       return Math.max(aggregate, value);
-    } else if (aggFunction.equals(MetricAggFunction.COUNT) && sourceName.equals("Pinot")) {
+    } else if (aggFunction.equals(MetricAggFunction.COUNT) && sourceName.equals(PINOT)) {
       return aggregate + 1;
     } else if (aggFunction.equals(MetricAggFunction.COUNT)) { // For all other COUNT cases
       return aggregate + value;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org