xiaohui-sun commented on a change in pull request #4176: [TE] anomaly detector 
interface change and implementation for rule-based detection
URL: https://github.com/apache/incubator-pinot/pull/4176#discussion_r279576045
 
 

 ##########
 File path: 
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/spi/model/TimeSeries.java
 ##########
 @@ -62,17 +71,34 @@ private static void addSeries(TimeSeries ts, DataFrame df, 
String name) {
     }
   }
 
+  /**
+   * return a empty time series
+   * @return a empty time series
+   */
+  public static TimeSeries empty(){
+    TimeSeries ts = new TimeSeries();
+    ts.df.addSeries(COL_TIME, LongSeries.empty()).addSeries(COL_VALUE, 
DoubleSeries.empty()).setIndex(COL_TIME);
+    return ts;
+  }
+
   /**
    * Add DataFrame into TimeSeries.
    * @param df The source DataFrame.
    * @return TimeSeries that contains the predicted values.
    */
   public static TimeSeries fromDataFrame(DataFrame df) {
+    Preconditions.checkArgument(df.contains(COL_TIME));
 
 Review comment:
   Good job to have this precondition check!

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