wu-sheng commented on a change in pull request #5132:
URL: https://github.com/apache/skywalking/pull/5132#discussion_r468627064



##########
File path: 
oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/TimeSeriesUtils.java
##########
@@ -60,6 +61,31 @@ public static String latestWriteIndexName(Model model) {
         }
     }
 
+    /**
+     * @return Concrete index name for super dataset index
+     */
+    public static String[] querySuperDatasetIndices(String indexName, long 
startTimeBucket, long endTimeBucket) {
+        if (startTimeBucket == 0 || endTimeBucket == 0) {
+            return new String[] {indexName};
+        }
+        long startDay = 
compressTimeBucket(convert2DayTimeBucket(startTimeBucket), 
SUPER_DATASET_DAY_STEP);
+        long endDay = compressTimeBucket(convert2DayTimeBucket(endTimeBucket), 
SUPER_DATASET_DAY_STEP);
+        DateTime startDateTime = TIME_BUCKET_FORMATTER.parseDateTime(startDay 
+ "");
+        DateTime endDateTime = TIME_BUCKET_FORMATTER.parseDateTime(endDay + 
"");
+
+        int steps = Math.max((Days.daysBetween(startDateTime, 
endDateTime).getDays()) / SUPER_DATASET_DAY_STEP, 0);
+        return IntStream.rangeClosed(0, steps)
+                        .mapToObj(step -> indexName + Const.LINE + 
startDateTime.plusDays(Math.toIntExact(SUPER_DATASET_DAY_STEP * 
step)).toString(TIME_BUCKET_FORMATTER))
+                        .toArray(String[]::new);
+    }
+
+    private static long convert2DayTimeBucket(long timeBucket) {

Review comment:
       Really? From my check, all these are running for TimeRangeIndexNameMaker 
and Trace query, the input parameter is always `startSecondTB`? Why it could be 
different formats?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to