harleyjj commented on a change in pull request #5011: [TE] endpoint - 
harleyjj/yamlresource - add dataset as an optional pa…
URL: https://github.com/apache/incubator-pinot/pull/5011#discussion_r370435266
 
 

 ##########
 File path: 
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlResource.java
 ##########
 @@ -907,8 +907,28 @@ public Response toggleActivation(
    */
   @GET
   @Path("/list")
+  @ApiOperation("Get the list of all detection YAML configurations as JSON 
enhanced with additional information, optionally filtered")
   @Produces(MediaType.APPLICATION_JSON)
-  public List<Map<String, Object>> listYamls() throws ExecutionException {
-    return 
this.detectionConfigDAO.findAll().parallelStream().map(this.detectionConfigFormatter::format).collect(Collectors.toList());
+  public List<Map<String, Object>> listYamls(
+      @ApiParam("Dataset the detection configurations should be filtered by") 
@QueryParam("dataset") String dataset) throws ExecutionException {
+    List<Map<String, Object>> yamls;
+    if (dataset == null) {
+      yamls = this.detectionConfigDAO
+          .findAll()
+          .parallelStream()
+          .map(this.detectionConfigFormatter::format)
+          .collect(Collectors.toList());
+    } else {
+      yamls = this.detectionConfigDAO
+          .findAll()
+          .parallelStream()
+          .map(this.detectionConfigFormatter::format)
+          .filter(y -> {
+            List<String> thisYaml = (List)y.get("datasetNames");
 
 Review comment:
   I added metric as an optional param, as well.  Would this comment still 
apply to the updated code?

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