Skip to content

Optimize aggregation of nulls#14123

Merged
wenleix merged 2 commits into
prestodb:masterfrom
mbasmanova:null-agg
Feb 23, 2020
Merged

Optimize aggregation of nulls#14123
wenleix merged 2 commits into
prestodb:masterfrom
mbasmanova:null-agg

Conversation

@mbasmanova

Copy link
Copy Markdown
Contributor
== NO RELEASE NOTE ==

@mbasmanova mbasmanova added the aria Presto Aria performance improvements label Feb 20, 2020
@mbasmanova mbasmanova requested review from a team and highker February 20, 2020 15:53
@highker highker requested a review from wenleix February 21, 2020 08:50

@highker highker left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Can @wenleix help taking a look?

@wenleix wenleix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % one minor question. Please feel free to merge it if I misunderstood anything :)

for (int i = 0; i < parameterVariables.size(); i++) {
if (!nullable.get(i)) {
Variable variableDefinition = parameterVariables.get(i);
forLoop = new IfStatement("if(!(%s instanceof RunLengthEncodedBlock && %s.isNull(0)))", variableDefinition.getName(), variableDefinition.getName())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: what about if (!(%s ... (basically add a space

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wenleix I was matching other comments in this file. They don't have space.

loopBody = new IfStatement("if(testMask(%s, position))", masksBlock.getName())

loopBody = new IfStatement("if(!%s.isNull(position))", variableDefinition.getName())

}
}

block.append(new IfStatement("if(%s > 0)", rowsVariable.getName())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is this if-statement is required in case the RLE block has 0 position count, so the block.isNull(0) on line 560 will fail.

Does it make sense to do the empty block check in the line 560 check? i.e.

   if (!(block instanceof RunLengthEncodedBlock && block.getPositionCount() != 0 && block.isNull(0))) {
        // for loop....
   }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this if-statement is required in case the RLE block has 0 position count, so the block.isNull(0) on line 560 will fail.

This is correct.

Does it make sense to do the empty block check in the line 560 check?

I don't have any particular preference, but it seems like empty page check applies even if block not an RLE.

@wenleix

wenleix commented Feb 23, 2020

Copy link
Copy Markdown
Contributor

@mbasmanova : Sounds good. Thanks for the explanation!

@wenleix wenleix merged commit 1e7780e into prestodb:master Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aria Presto Aria performance improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants