akshayrai commented on a change in pull request #4900: [TE][detection]
Implement anomalies cache to speed up detection
URL: https://github.com/apache/incubator-pinot/pull/4900#discussion_r359159537
##########
File path:
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/spi/model/AnomalySlice.java
##########
@@ -120,11 +119,46 @@ public AnomalySlice withIsTaggedAsChild(boolean
isTaggedAsChild) {
return new AnomalySlice(this.detectionId, this.start, this.end,
this.filters, this.detectionComponentNames, isTaggedAsChild);
}
+ /**
+ * Check if current anomaly slice contains another anomaly slice
+ *
+ * We will say one slice (current) contains another slice(request) when
+ * a. Slices are fetching anomalies for the same detection
+ * b. The time range of the request slice falls within the current slice
+ * c. current filters are empty or exactly match request filters.
+ * d. current detectionComponentNames are empty or contains request
detectionComponentNames
+ *
+ * Note: Empty filters will fetch all the anomalies regardless of the
anomalous dimension.
+ * Similarly, empty detectionComponentNames will fetch all the anomalies.
+ */
+ public boolean containSlice(AnomalySlice requestSlice) {
+ if (requestSlice.getDetectionId() != this.detectionId
+ || requestSlice.getStart() < this.getStart()
+ || requestSlice.getEnd() > this.getEnd()) {
Review comment:
It shouldn't matter as we comparing slices.
----------------------------------------------------------------
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]