[TE] onboarding - fix dataset filtering
@@ -20,6 +20,7 @@ import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -94,14 +95,14 @@ public class AutoOnboardPinotDataSource extends AutoOnboard {
List<DatasetConfigDTO> allExsistingDataset = this.datasetDAO.findAll();
Set<String> datasets = new HashSet<>(allDatasets);
- Collections2.filter(allExsistingDataset, new com.google.common.base.Predicate<DatasetConfigDTO>() {
+ Collection<DatasetConfigDTO> filtered = Collections2.filter(allExsistingDataset, new com.google.common.base.Predicate<DatasetConfigDTO>() {
@Override
public boolean apply(@Nullable DatasetConfigDTO datasetConfigDTO) {
return datasetConfigDTO.getDataSource().equals(PinotThirdEyeDataSource.DATA_SOURCE_NAME);
}
});
- for (DatasetConfigDTO datasetConfigDTO : allExsistingDataset) {
+ for (DatasetConfigDTO datasetConfigDTO : filtered) {
if (shouldRemoveDataset(datasetConfigDTO, datasets)) {
datasetDAO.deleteByPredicate(Predicate.EQ("dataset", datasetConfigDTO.getDataset()));
}
