Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Reuse SourceDestValidator for data frame analytics #50841

Conversation

dimitris-athanasiou
Copy link
Contributor

This commit removes validation logic of source and dest indices
for data frame analytics and replaces it with using the common
SourceDestValidator class which is already used by transforms.
This way the validations and their messages become consistent
while we reduce code.

This means that where these validations fail the error messages
will be slightly different for data frame analytics.

This commit removes validation logic of source and dest indices
for data frame analytics and replaces it with using the common
`SourceDestValidator` class which is already used by transforms.
This way the validations and their messages become consistent
while we reduce code.

This means that where these validations fail the error messages
will be slightly different for data frame analytics.
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ml-core (:ml)

@@ -46,7 +46,6 @@

// messages
public static final String SOURCE_INDEX_MISSING = "Source index [{0}] does not exist";
public static final String SOURCE_LOWERCASE = "Source index [{0}] must be lowercase";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was unused.

Copy link
Contributor

@hendrikmuhs hendrikmuhs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some re-factoring leftovers which only need some cleanup (delete)

@@ -427,13 +417,13 @@ public void validate(Context context, ActionListener<Context> listener) {
return;
}

if (context.resolvedSource.contains(destIndex)) {
if (context.resolveSource().contains(destIndex)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice spot!

// ),
// true,
// null
// );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ needs re-activation or should be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reactivated it. Good catch.

@@ -464,21 +478,11 @@ public void testCheck_GivenDestIndexIsAliasThatMatchesMultipleIndices() throws I
CLUSTER_STATE,
new String[] { SOURCE_1 },
DEST_ALIAS,
SourceDestValidator.NON_DEFERABLE_VALIDATIONS,
Collections.emptyList(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not getting this change, should the test be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These second assertions in those tests seem to be testing that when the validation is not present then the error does not occur. Previously the NON_DEFERABLE_VALIDATIONS set was passed around but I could not see what the difference was compared to passing an empty list. Does this make sense?

@dimitris-athanasiou dimitris-athanasiou merged commit 2d59c84 into elastic:master Jan 10, 2020
@dimitris-athanasiou dimitris-athanasiou deleted the reuse-source-dest-validator-for-df-analytics branch January 10, 2020 11:17
dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request Jan 10, 2020
…#50841)

This commit removes validation logic of source and dest indices
for data frame analytics and replaces it with using the common
`SourceDestValidator` class which is already used by transforms.
This way the validations and their messages become consistent
while we reduce code.

This means that where these validations fail the error messages
will be slightly different for data frame analytics.

Backport of elastic#50841
dimitris-athanasiou added a commit that referenced this pull request Jan 10, 2020
…#50850)

This commit removes validation logic of source and dest indices
for data frame analytics and replaces it with using the common
`SourceDestValidator` class which is already used by transforms.
This way the validations and their messages become consistent
while we reduce code.

This means that where these validations fail the error messages
will be slightly different for data frame analytics.

Backport of #50841
SivagurunathanV pushed a commit to SivagurunathanV/elasticsearch that referenced this pull request Jan 23, 2020
This commit removes validation logic of source and dest indices
for data frame analytics and replaces it with using the common
`SourceDestValidator` class which is already used by transforms.
This way the validations and their messages become consistent
while we reduce code.

This means that where these validations fail the error messages
will be slightly different for data frame analytics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants