-
Notifications
You must be signed in to change notification settings - Fork 25.5k
ESQL: Remove extra block calls in evaluators and aggregators #135919
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
base: main
Are you sure you want to change the base?
ESQL: Remove extra block calls in evaluators and aggregators #135919
Conversation
builder.addCode("case 1:\n"); | ||
builder.addStatement("break"); |
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.
This looks a bit weird, but I'm not sure if this is better than a variable + 2 ifs, like:
if (count == 0) { null + continue }
else if (count > 1) { warning + null + continue }
Pinging @elastic/es-analytical-engine (Team:Analytics) |
private void addRawBlock(LongBlock vBlock) { | ||
for (int p = 0; p < vBlock.getPositionCount(); p++) { | ||
if (vBlock.isNull(p)) { | ||
int vValueValueCount = vBlock.getValueCount(p); |
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.
vValueValueCount
-> vValueCount
probably.
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.
Fixed!
if (valBlock.isNull(p)) { | ||
switch (valBlock.getValueCount(p)) { | ||
case 0: | ||
result.appendNull(); |
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 you indent here?
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.
Sure. I thought it was correct because spotless didn't change it. Only to remember now that spotless ignore these files :hehe:
2 implementers changed:
isNull() + getValueCount()
to a singlegetValueCount()
.getValueCount()
delegates toisNull()
internally for Array blocks, and they're supposed to be in sync.getValueCount() == 0
after theisNull() == false
)These changes were made to:
isNull()
to agetValueCount()
delegating toisNull()
in some casesisNull() + getValueCount()
by removing theisNull()
, which could access aBitSet
Aggs microbenchmarks show no differences.