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

 ##########
 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:
   If the metrics is derived, we need to get all the datasets from the 
expression and skip using the value under `dataset` field in the 
`metricConfig`. If the metrics is not derived, we still need to add the 
`dataset` field in the `metricConfig` into the list. I am not sure that I can 
remove either the if-block or else-block.

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