-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
[ML] Reuse SourceDestValidator for data frame analytics #50841
Conversation
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.
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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was unused.
There was a problem hiding this 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)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice spot!
// ), | ||
// true, | ||
// null | ||
// ); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
…#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
…#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
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.