Skip to content

Commit

Permalink
[ML] Add check to isPickFieldsStepValid and remove lodash/uniq
Browse files Browse the repository at this point in the history
  • Loading branch information
qn895 committed Aug 19, 2020
1 parent cd59230 commit 38edcdd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 7 additions & 6 deletions x-pack/plugins/ml/common/util/job_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import isEmpty from 'lodash/isEmpty';
import isEqual from 'lodash/isEqual';
import each from 'lodash/each';
import pick from 'lodash/pick';
import uniq from 'lodash/uniq';

import semver from 'semver';
import moment, { Duration } from 'moment';
Expand Down Expand Up @@ -430,11 +429,13 @@ export function basicJobValidation(
d.over_field_name === MLCATEGORY ||
d.partition_field_name === MLCATEGORY
);
const uniqPartitions = uniq(
categorizationDetectors
.map((d) => d.partition_field_name)
.filter((name) => name !== undefined)
);
const uniqPartitions = [
...new Set(
categorizationDetectors
.map((d) => d.partition_field_name)
.filter((name) => name !== undefined)
),
];
if (uniqPartitions.length > 1) {
valid = false;
messages.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ export class JobValidator {
(this._jobCreator.type === JOB_TYPE.ADVANCED && this.modelMemoryLimit.valid)) &&
this.bucketSpan.valid &&
this.duplicateDetectors.valid &&
this.categorizerMissingPerPartition.valid &&
this.categorizerVaryingPerPartitionField.valid &&
!this.validating &&
(this._jobCreator.type !== JOB_TYPE.CATEGORIZATION ||
(this._jobCreator.type === JOB_TYPE.CATEGORIZATION && this.categorizationField))
Expand Down

0 comments on commit 38edcdd

Please sign in to comment.