Search in sources :

Example 16 with Predicate

use of com.linkedin.thirdeye.datalayer.util.Predicate in project pinot by linkedin.

the class JobManagerImpl method deleteRecordsOlderThanDaysWithStatus.

@Override
@Transactional
public int deleteRecordsOlderThanDaysWithStatus(int days, JobStatus status) {
    DateTime expireDate = new DateTime().minusDays(days);
    Timestamp expireTimestamp = new Timestamp(expireDate.getMillis());
    Predicate statusPredicate = Predicate.EQ("status", status.toString());
    Predicate timestampPredicate = Predicate.LT("updateTime", expireTimestamp);
    List<JobBean> list = genericPojoDao.get(Predicate.AND(statusPredicate, timestampPredicate), JobBean.class);
    for (JobBean jobBean : list) {
        deleteById(jobBean.getId());
    }
    return list.size();
}
Also used : JobBean(com.linkedin.thirdeye.datalayer.pojo.JobBean) Timestamp(java.sql.Timestamp) DateTime(org.joda.time.DateTime) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate) Transactional(com.google.inject.persist.Transactional)

Example 17 with Predicate

use of com.linkedin.thirdeye.datalayer.util.Predicate in project pinot by linkedin.

the class MergedAnomalyResultManagerImpl method findByFunctionIdAndIdGreaterThan.

@Override
public List<MergedAnomalyResultDTO> findByFunctionIdAndIdGreaterThan(Long functionId, Long anomalyId) {
    Predicate predicate = Predicate.AND(Predicate.EQ("functionId", functionId), Predicate.GT("baseId", anomalyId));
    List<MergedAnomalyResultBean> list = genericPojoDao.get(predicate, MergedAnomalyResultBean.class);
    return batchConvertMergedAnomalyBean2DTO(list, true);
}
Also used : MergedAnomalyResultBean(com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 18 with Predicate

use of com.linkedin.thirdeye.datalayer.util.Predicate in project pinot by linkedin.

the class MergedAnomalyResultManagerImpl method getAllByTimeEmailIdAndNotifiedFalse.

@Override
public List<MergedAnomalyResultDTO> getAllByTimeEmailIdAndNotifiedFalse(long startTime, long endTime, long emailConfigId) {
    EmailConfigurationBean emailConfigurationBean = genericPojoDao.get(emailConfigId, EmailConfigurationBean.class);
    List<Long> functionIds = emailConfigurationBean.getFunctionIds();
    if (functionIds == null || functionIds.isEmpty()) {
        return Collections.emptyList();
    }
    Long[] functionIdArray = functionIds.toArray(new Long[] {});
    Predicate predicate = //
    Predicate.AND(//
    Predicate.LT("startTime", endTime), //
    Predicate.GT("endTime", startTime), //
    Predicate.IN("functionId", functionIdArray), //
    Predicate.EQ("notified", false));
    List<MergedAnomalyResultBean> list = genericPojoDao.get(predicate, MergedAnomalyResultBean.class);
    return batchConvertMergedAnomalyBean2DTO(list, true);
}
Also used : MergedAnomalyResultBean(com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean) EmailConfigurationBean(com.linkedin.thirdeye.datalayer.pojo.EmailConfigurationBean) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 19 with Predicate

use of com.linkedin.thirdeye.datalayer.util.Predicate in project pinot by linkedin.

the class DataCompletenessConfigManagerImpl method findAllByTimeOlderThan.

@Override
public List<DataCompletenessConfigDTO> findAllByTimeOlderThan(long time) {
    Predicate predicate = Predicate.LT("dateToCheckInMS", time);
    List<DataCompletenessConfigBean> list = genericPojoDao.get(predicate, DataCompletenessConfigBean.class);
    return convertListOfBeanToDTO(list);
}
Also used : DataCompletenessConfigBean(com.linkedin.thirdeye.datalayer.pojo.DataCompletenessConfigBean) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 20 with Predicate

use of com.linkedin.thirdeye.datalayer.util.Predicate in project pinot by linkedin.

the class DataCompletenessConfigManagerImpl method findAllByDatasetAndInTimeRangeAndPercentCompleteGT.

@Override
public List<DataCompletenessConfigDTO> findAllByDatasetAndInTimeRangeAndPercentCompleteGT(String dataset, long startTime, long endTime, double percentComplete) {
    Predicate timePredicate = Predicate.AND(Predicate.GE("dateToCheckInMS", startTime), Predicate.LT("dateToCheckInMS", endTime));
    Predicate datasetPredicate = Predicate.EQ("dataset", dataset);
    Predicate percentCompletePrediate = Predicate.GT("percentComplete", percentComplete);
    List<DataCompletenessConfigBean> list = genericPojoDao.get(Predicate.AND(datasetPredicate, timePredicate, percentCompletePrediate), DataCompletenessConfigBean.class);
    return convertListOfBeanToDTO(list);
}
Also used : DataCompletenessConfigBean(com.linkedin.thirdeye.datalayer.pojo.DataCompletenessConfigBean) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Aggregations

Predicate (com.linkedin.thirdeye.datalayer.util.Predicate)53 ArrayList (java.util.ArrayList)19 DataCompletenessConfigBean (com.linkedin.thirdeye.datalayer.pojo.DataCompletenessConfigBean)9 MergedAnomalyResultBean (com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean)7 MetricConfigDTO (com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO)5 MetricConfigBean (com.linkedin.thirdeye.datalayer.pojo.MetricConfigBean)5 Transactional (com.google.inject.persist.Transactional)4 AutotuneConfigBean (com.linkedin.thirdeye.datalayer.pojo.AutotuneConfigBean)4 AnomalyFunctionDTO (com.linkedin.thirdeye.datalayer.dto.AnomalyFunctionDTO)3 DashboardConfigDTO (com.linkedin.thirdeye.datalayer.dto.DashboardConfigDTO)3 DatasetConfigDTO (com.linkedin.thirdeye.datalayer.dto.DatasetConfigDTO)3 EventDTO (com.linkedin.thirdeye.datalayer.dto.EventDTO)3 IngraphMetricConfigDTO (com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO)3 TaskDTO (com.linkedin.thirdeye.datalayer.dto.TaskDTO)3 AnomalyFunctionBean (com.linkedin.thirdeye.datalayer.pojo.AnomalyFunctionBean)3 DashboardConfigBean (com.linkedin.thirdeye.datalayer.pojo.DashboardConfigBean)3 DatasetConfigBean (com.linkedin.thirdeye.datalayer.pojo.DatasetConfigBean)3 DetectionStatusBean (com.linkedin.thirdeye.datalayer.pojo.DetectionStatusBean)3 EmailConfigurationBean (com.linkedin.thirdeye.datalayer.pojo.EmailConfigurationBean)3 EventBean (com.linkedin.thirdeye.datalayer.pojo.EventBean)3