-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Add '$' syntax as a shortcut for 'field' in Painless #80518
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
Conversation
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
...g-painless/src/main/java/org/elasticsearch/painless/phase/PainlessSemanticAnalysisPhase.java
Outdated
Show resolved
Hide resolved
modules/lang-painless/src/main/java/org/elasticsearch/painless/antlr/Walker.java
Show resolved
Hide resolved
...g-painless/src/main/java/org/elasticsearch/painless/phase/PainlessSemanticAnalysisPhase.java
Show resolved
Hide resolved
...g-painless/src/main/java/org/elasticsearch/painless/phase/PainlessUserTreeToIRTreePhase.java
Show resolved
Hide resolved
stu-elastic
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.
lgtm with some tests and a comment on the way forward regarding the specialization of $ in the asm phase.
|
@stu-elastic Thanks for the review! Will add some more tests and roll from there. |
|
Added additional tests. Will commit as soon as CI passes. |
This adds a shortcut for the
fieldmethod when a script context supports the scripting fields API. This shortcut replacesfield('fieldname').get(defaultValue)with$('fieldname', defaultValue). This change builds this into the Painless compiler, but eventually this can be easily refactored out to make it so the '$' could be specialized per context.