apucher closed pull request #3530:  [TE] datasource - aggregate to one minute 
level for epoch timestamp
URL: https://github.com/apache/incubator-pinot/pull/3530
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/datasource/pinot/PqlUtils.java
 
b/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/datasource/pinot/PqlUtils.java
index 39c1cf12b1..11281a0cc3 100644
--- 
a/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/datasource/pinot/PqlUtils.java
+++ 
b/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/datasource/pinot/PqlUtils.java
@@ -348,11 +348,10 @@ static String getDimensionWhereClause(Multimap<String, 
String> dimensionValues)
     return AND.join(components);
   }
 
-  private static String convertEpochToAggGranularity(String timeColumnName, 
TimeSpec timeSpec, TimeGranularity aggregationGranularity) {
-    String groupByTimeColumnName = 
String.format("dateTimeConvert(%s,'%d:%s:%s','%d:%s:%s','%d:%s')", 
timeColumnName,
+  private static String convertEpochToMinuteAggGranularity(String 
timeColumnName, TimeSpec timeSpec) {
+    String groupByTimeColumnName = 
String.format("dateTimeConvert(%s,'%d:%s:%s','%d:%s:%s','1:MINUTES')", 
timeColumnName,
         timeSpec.getDataGranularity().getSize(), 
timeSpec.getDataGranularity().getUnit(), timeSpec.getFormat(),
-        timeSpec.getDataGranularity().getSize(), 
timeSpec.getDataGranularity().getUnit(), timeSpec.getFormat(),
-        aggregationGranularity.getSize(), aggregationGranularity.getUnit());
+        timeSpec.getDataGranularity().getSize(), 
timeSpec.getDataGranularity().getUnit(), timeSpec.getFormat());
     return groupByTimeColumnName;
   }
 
@@ -361,11 +360,11 @@ private static String 
getDimensionGroupByClause(List<String> groupBy,
     String timeColumnName = timeSpec.getColumnName();
     List<String> groups = new LinkedList<>();
     if (aggregationGranularity != null && !groups.contains(timeColumnName)) {
-      // Convert the time column to aggregation granularity if it is epoch.
-      // E.g., 
dateTimeConvert(timestampInEpoch,'1:MILLISECONDS:EPOCH','1:MILLISECONDS:EPOCH','15:MINUTES')
+      // Convert the time column to 1 minute granularity if it is epoch.
+      // E.g., 
dateTimeConvert(timestampInEpoch,'1:MILLISECONDS:EPOCH','1:MILLISECONDS:EPOCH','1:MINUTES')
       if 
(timeSpec.getFormat().equals(TimeGranularitySpec.TimeFormat.EPOCH.toString())
           && !timeSpec.getDataGranularity().equals(aggregationGranularity)) {
-        String groupByTimeColumnName = 
convertEpochToAggGranularity(timeColumnName, timeSpec, aggregationGranularity);
+        String groupByTimeColumnName = 
convertEpochToMinuteAggGranularity(timeColumnName, timeSpec);
         groups.add(groupByTimeColumnName);
       } else {
         groups.add(timeColumnName);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to