xiaohui-sun commented on a change in pull request #4777: [TE] add event driven 
scheduler
URL: https://github.com/apache/incubator-pinot/pull/4777#discussion_r346485956
 
 

 ##########
 File path: 
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/util/ThirdEyeUtils.java
 ##########
 @@ -370,9 +372,19 @@ public static DatasetConfigDTO 
getDatasetConfigFromName(String dataset) {
     return datasetConfig;
   }
 
-  public static String getDatasetFromMetricFunction(MetricFunction 
metricFunction) {
-    MetricConfigDTO metricConfig = 
getMetricConfigFromId(metricFunction.getMetricId());
-    return metricConfig.getDataset();
+  public static List<DatasetConfigDTO> getDatasetConfigsFromMetricUrn(String 
metricUrn) {
+    DatasetConfigManager datasetConfigManager = 
DAORegistry.getInstance().getDatasetConfigDAO();
+    MetricEntity me = MetricEntity.fromURN(metricUrn);
+    MetricConfigDTO metricConfig = 
DAORegistry.getInstance().getMetricConfigDAO().findById(me.getId());
+    if (metricConfig == null) return new ArrayList<>();
+    if (!metricConfig.isDerived()) {
+      return 
Collections.singletonList(datasetConfigManager.findByDataset(metricConfig.getDataset()));
+    } else {
 
 Review comment:
   Minor: No need to add "else" after "return".
   if () {
   return()
   }
   // The logic for else

----------------------------------------------------------------
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]


With regards,
Apache Git Services

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

Reply via email to