SQL: Internal refactoring of operators as functions#34097
Merged
costin merged 2 commits intoelastic:masterfrom Sep 27, 2018
Merged
SQL: Internal refactoring of operators as functions#34097costin merged 2 commits intoelastic:masterfrom
costin merged 2 commits intoelastic:masterfrom
Conversation
Rename ProcessDefinition to Pipe Add asScript / asPipe onto Expression (might be pushed further down) Add ScriptWeaver as a mixin-in interface for script customization Add logic for equals/lte/lt Improve BinaryOperator/expression toString Minimize duplication across string functions Close elastic#33975
Collaborator
|
Pinging @elastic/es-search-aggs |
matriv
approved these changes
Sep 27, 2018
Contributor
matriv
left a comment
There was a problem hiding this comment.
LGTM. Nice stuff! Left two really minor comments.
| public int hashCode() { | ||
| return location().hashCode(); | ||
| } | ||
|
|
| dataType()); | ||
| } | ||
|
|
||
| default String formatScript(String template) { |
Contributor
There was a problem hiding this comment.
maybe rename template -> script ?
astefan
reviewed
Sep 27, 2018
| /** | ||
| * Binary operator. Operators act as _special_ functions in that they have a symbol | ||
| * instead of a name and do not use parathensis. | ||
| * Further more they are don't registered as the rest of the functions as are implicit |
Contributor
There was a problem hiding this comment.
Probably you meant "they are not registered".
astefan
reviewed
Sep 27, 2018
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * Processor definition for math operations requiring two arguments. |
Contributor
There was a problem hiding this comment.
Not a processor definition anymore
astefan
reviewed
Sep 27, 2018
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * Processor definition for String operations requiring one string and one numeric argument. |
Contributor
There was a problem hiding this comment.
Not a processor definition anymore
astefan
reviewed
Sep 27, 2018
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * Processor definition for String operations requiring two string arguments. |
Contributor
There was a problem hiding this comment.
Not a processor definition anymore
astefan
approved these changes
Sep 27, 2018
Contributor
astefan
left a comment
There was a problem hiding this comment.
Left some minor comments. LGTM
costin
added a commit
that referenced
this pull request
Sep 27, 2018
Centralize and simplify the script generation between operators and functions which are currently decoupled. As part of this process most predicates (<, <=, etc...) were made ScalarFunction as their purpose and functionality is quite similar (see % and MOD functions). Renamed ProcessDefinition to Pipe Add ScriptWeaver as a mixin-in interface for script customization Add logic for equals/lte/lt Improve BinaryOperator/expression toString Minimize duplication across string functions Close #33975 (cherry picked from commit 15515a6)
Member
Author
|
Merged - thanks for the quick reviews! |
jasontedor
added a commit
to jasontedor/elasticsearch
that referenced
this pull request
Sep 28, 2018
* master: Use more precise does S3 bucket exist method (elastic#34123) LLREST: Introduce a strict mode (elastic#33708) [CCR] Adjust list retryable errors (elastic#33985) Fix AggregationFactories.Builder equality and hash regarding order (elastic#34005) MINOR: Remove some deadcode in NodeEnv and Related (elastic#34133) Rest-Api-Spec: Correct spelling in filter_path description (elastic#33154) Core: Don't rely on java time for epoch seconds formatting (elastic#34086) Retry errors when fetching follower global checkpoint. (elastic#34019) Watcher: Reenable watcher stats REST tests (elastic#34107) Remove special-casing of Synonym filters in AnalysisRegistry (elastic#34034) Rename CCR APIs (elastic#34027) Fixed CCR stats api serialization issues and (elastic#33983) Support 'string'-style queries on metadata fields when reasonable. (elastic#34089) Logging: Drop Settings from security logger get calls (elastic#33940) SQL: Internal refactoring of operators as functions (elastic#34097)
kcm
pushed a commit
that referenced
this pull request
Oct 30, 2018
Centralize and simplify the script generation between operators and functions which are currently decoupled. As part of this process most predicates (<, <=, etc...) were made ScalarFunction as their purpose and functionality is quite similar (see % and MOD functions). Renamed ProcessDefinition to Pipe Add ScriptWeaver as a mixin-in interface for script customization Add logic for equals/lte/lt Improve BinaryOperator/expression toString Minimize duplication across string functions Close #33975
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Sorry for the largish PR, the renaming and moving of some files had a broad effect (the PR actually adds only ~300 loc).
The main goal of this PR is to centralize and simplify the script generation between operators and functions which are currently decoupled. As part of this process most predicates (
<,<=, etc...) were madeScalarFunctionas their purpose and functionality is quite similar (see%andMODfunctions).In a similar vein, the script generation and processing was moved ontowas moved to theExpressionitself as a general concern - it the future it might be tweaked a bit andNamedExpression.ProcessDefinitionwas renamed toPipeto make the name shorter and a bit more clearer (a Pipe of processes) though it doesn't fully convey its purpose.The advantage of moving this into the expression itself is that OO-ify the generation.
The script customization which was scattered across the code is now centralized into
ScriptWeaver.In the process, applied de-duplication over some function definitions, in particular String ones.
Lastly, this work started as part of the
NULLsupport as every scripted operation, including operators (like-) need to be made null-safe. This essentially means having the same infrastructure across all pushed-down expressions.Close #33975