-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Scripting: Cache script results if deterministic #50106
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
Merged
stu-elastic
merged 49 commits into
elastic:master
from
stu-elastic:feature/painless-caching-part-2
Dec 18, 2019
Merged
Changes from 18 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
cf07b27
Notes
stu-elastic 593da60
Wiring from whitelist annotations to PainlessMethod and PainlessConst…
stu-elastic d1ae37f
Generate isResultDeterministic
stu-elastic 45e3aed
formatting, parseInt is deterministic
stu-elastic bbc74fe
Merge branch 'master' of github.com:elastic/elasticsearch into featur…
stu-elastic db77cde
WIP
stu-elastic 16a2f44
update whitelist based on core-infra discussion, map/set iterators ar…
stu-elastic e13698c
Merge branch 'master' of github.com:elastic/elasticsearch into featur…
stu-elastic 91883d3
Revert LinkedHashMap
stu-elastic a5468ac
MaxAggregatorTests.testDontCacheScripts -> testCacheScripts
stu-elastic 5b14a33
remove stale TODOs
stu-elastic 25220c4
handle imported and static methods
stu-elastic da28b3c
Merge branch 'master' of github.com:elastic/elasticsearch into featur…
stu-elastic 39337fb
setDeterministic -> markNonDeterministic
stu-elastic fec15a6
MultiValuesSourceFieldConfig, use {read,write}OptionalString for fiel…
stu-elastic 91eaf70
Merge branch 'master' of github.com:elastic/elasticsearch into featur…
stu-elastic 91062b4
this.deterministic &= deterministic -> this.deterministic &= !nondete…
stu-elastic 681d271
guard writeOptional against pre-v7.6.0
stu-elastic c5ccb6f
disable bwc testing until 7.6 backport
stu-elastic e26999e
add pr link
stu-elastic b11dd3a
System.nanoTime/currentTimeMillis non, Collections.shuffle with rand …
stu-elastic 2d45bed
Update script cache testing in HDRPercentilesIT, TDigestPercentileRan…
stu-elastic 0b58b9d
Add MockDeterministicScript and use it in MockScriptEngine.
stu-elastic dd2c3c3
Update DateRangeIT
stu-elastic 9020cdd
Update DoubleTermsIT
stu-elastic b0fc18b
Update HistogramIT
stu-elastic 81d6df9
Update LongTermsIT
stu-elastic fcb6ac6
Update RangeIT
stu-elastic 79641f7
Update SignificantTermsSignificanceScoreIT
stu-elastic edb16ba
Update StringTermsIT
stu-elastic a9c9256
Update AvgAggregatorTests
stu-elastic 4b9c283
CardinalityIT
stu-elastic 528a6a4
Update ExtendedStatsIT
stu-elastic 53be9e4
Update HDRPercentileRanksIT
stu-elastic 3306461
Update HDRPercentilesIT
stu-elastic e464221
Update MaxAggregatorTests MedianAbsoluteDeviationIT
stu-elastic cf5585f
Update MinIT
stu-elastic b2a113d
Update ScriptedMetricIT
stu-elastic f21c252
Update StatsIT
stu-elastic 7acb0fe
Update SumIT
stu-elastic 45a9f07
Update TDigestPercentileRanksIT
stu-elastic 872bed4
Update TDigestPercentilesIT
stu-elastic e0ed60a
Update TopHitsIT
stu-elastic 40292e0
Update ValueCountIT
stu-elastic af9df68
MinIT merged into MinAggregatorTests
stu-elastic 04e5530
Update MinAggregatorTests
stu-elastic a1a572e
Use reproducable random methods instead of Math.random
stu-elastic e7c1171
Remove unnecessary publics, rearrange imports, correct indent
stu-elastic b808b39
Mark Calendar and Clock methods nondeterministic
stu-elastic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...i/src/main/java/org/elasticsearch/painless/spi/annotation/NonDeterministicAnnotation.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.painless.spi.annotation; | ||
|
||
public class NonDeterministicAnnotation { | ||
|
||
public static final String NAME = "nondeterministic"; | ||
|
||
public static final NonDeterministicAnnotation INSTANCE = new NonDeterministicAnnotation(); | ||
|
||
private NonDeterministicAnnotation() {} | ||
} |
40 changes: 40 additions & 0 deletions
40
...main/java/org/elasticsearch/painless/spi/annotation/NonDeterministicAnnotationParser.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.painless.spi.annotation; | ||
|
||
import java.util.Map; | ||
|
||
public class NonDeterministicAnnotationParser implements WhitelistAnnotationParser { | ||
|
||
public static final NonDeterministicAnnotationParser INSTANCE = new NonDeterministicAnnotationParser(); | ||
|
||
private NonDeterministicAnnotationParser() {} | ||
|
||
@Override | ||
public Object parse(Map<String, String> arguments) { | ||
stu-elastic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (arguments.isEmpty() == false) { | ||
throw new IllegalArgumentException( | ||
"unexpected parameters for [@" + NonDeterministicAnnotation.NAME + "] annotation, found " + arguments | ||
); | ||
} | ||
|
||
return NonDeterministicAnnotation.INSTANCE; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.