-
Notifications
You must be signed in to change notification settings - Fork 25.7k
ES|QL: Move SET command out of snapshot and move validation to single settings #137204
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
ES|QL: Move SET command out of snapshot and move validation to single settings #137204
Conversation
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
ivancea
left a comment
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.
Looks good, thanks!
With some luck, this PR adding SET tests is merged soon too, so the SET statement is "fully scaffolded"
| import org.elasticsearch.Build; | ||
| import org.elasticsearch.transport.RemoteClusterService; | ||
|
|
||
| public class SettingsValidationContext { |
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.
nit: As the tests are subclassing this, and to avoid calling Build.current().isSnapshot() multiple times in production, maybe this should be a record (crossProjectEnabled, isSnapshot), and have a custom constructor accepting the RemoteClusterService and calling isSnapshot().
Maybe this approach is somewhat shortsighted if we want to add more derived states or services, so take it with a grain of salt!
|
|
||
| public void testValidate_ProjectRouting_noCps() { | ||
| var setting = QuerySettings.PROJECT_ROUTING; | ||
| assumeTrue("CPS validation not enabled yet", setting.preview()); |
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.
I find this check dangerous, as we may forget about it, and not test it later even if it's already implemented.
This is actually a commented test under the hood; maybe we should just comment it, and add a comment with the why.
More visible than an assumption that will never be truthy
|
Thanks @ivancea! |
…review' into esql/set_command_tech_preview
Moving the validation to the level of single settings, based on their
snapshotflag.Also doing some refactoring to inject specific validation for
project_routing, based on CPS being enabled, and to make unit tests easier to write.