-
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
Require combine and reduce scripts in scripted metrics aggregation #33452
Conversation
Pinging @elastic/es-search-aggs |
Since first creating this there is now a conflict. Do I need to resolve the conflicts before anyone takes a look? |
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.
@albendz I left a small comment but I think this looks pretty good. If you could address that and update the branch with the latest master I'll kick of a CI build
throw new IllegalArgumentException("[combineScript] must not be null: [" + name + "]"); | ||
} | ||
|
||
if(reduceScript == 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.
Could we do these null checks at the start of the method before we compile any scripts?
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.
Will fix.
@colings86 I tried moving the null checks but it changed the test behavior. The init scripts might be setting those values so the order might need to stay afterwards. It takes some time to rerun the tests so I'll keep trying to figure this out but it will take a while. |
compiledCombineScript = queryShardContext.getScriptService().compile(combineScript, | ||
ScriptedMetricAggContexts.CombineScript.CONTEXT); | ||
combineScriptParams = combineScript.getParams(); | ||
} else { |
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 think we should leave lines 204-206 here where they were below but just have the null
check here so here its just:
if (combineScript == null) {
throw new IllegalArgumentException("[combineScript] must not be null: [" + name + "]");
}
And then below after the map script parts we have:
ScriptedMetricAggContexts.CombineScript.Factory compiledCombineScript = queryShardContext.getScriptService().compile(combineScript, ScriptedMetricAggContexts.CombineScript.CONTEXT);
Map<String, Object> combineScriptParams = combineScript.getParams();
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.
Making this change causes all the integ tests to fail and I haven't been able to debug why yet.
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.
all = all the scripted metric IT integ tests
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.
As I said, this combination fails the integration tests and I'm not sure why. It seems the return values of the test scripts are returning different values if done this way.
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.
So, I'm currently debugging issues with the dummy scripts interfering with return values. It takes a while since they are integ tests. Just letting you know I'm still working on this.
Fixed - integ tests should have failed for my initial script but for whatever reason they did not (possibly because of a failed clean task). |
@elasticmachine test this please |
@albendz it looks like the build for an unrelated reason. Would you mind updating the branch with the latest master and I'll set the tests off again? |
I've updated the branch. Some unrelated tests failed but that might be slowness from my machine. |
@elasticmachine test this please |
@albendz I think this change looks good now. However I have forgotten about two things that will need to be done before this can be merged:
Are you happy to make these changes? Sorry for not raising this to you before, doing this two things had slipped my mind. |
I will try to get started on these changes but I will be unavailable for 3 weeks starting Oct 4. I'll see how far I get! |
Can you give me an example of what using the deprecation logger looks like? |
Created 6.x PR: #34254 |
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.
Thanks for the work and for creating the 6.x version of this change. providing the current test runs succeed I'll go ahead an merge these changes
@elasticmachine test this please |
@albendz thanks for working on this, I've merged this change into master and 6.x |
When combine_script and reduce_script were made into required parameters for Scripted Metric aggregations in #33452, the docs were not updated to reflect that. This marks those parameters as required in the documentation.
…33452) * Make text message not required in constructor for slack * Remove unnecessary comments in test file * Throw exception when reduce or combine is not provided; update tests * Update integration tests for scripted metrics to always include reduce and combine * Remove some old changes from previous branches * Rearrange script presence checks to be earlier in build * Change null check order in script builder for aggregated metrics; correct test scripts in IT * Add breaking change details to PR
When combine_script and reduce_script were made into required parameters for Scripted Metric aggregations in #33452, the docs were not updated to reflect that. This marks those parameters as required in the documentation.
Fixes #32804
Implementation notes:
no combine, no reduce -> exception
combine, no reduce -> exception
no combine, reduce -> exception
combine, reduce -> success