Skip to content

Big arrays sliced from netty buffers (long)#91641

Merged
elasticsearchmachine merged 7 commits intoelastic:mainfrom
martijnvg:netty_long_array
Nov 23, 2022
Merged

Big arrays sliced from netty buffers (long)#91641
elasticsearchmachine merged 7 commits intoelastic:mainfrom
martijnvg:netty_long_array

Conversation

@martijnvg
Copy link
Copy Markdown
Member

Based on #90745 but for longs. This should allow aggregations down the road to read long values directly from netty buffer, rather than copying it from the netty buffer.

Relates to #89437

Based on elastic#90745 but for longs. This should allow aggregations down the road to read long values
directly from netty buffer, rather than copying it from the netty buffer.

Relates to elastic#89437
@martijnvg martijnvg marked this pull request as ready for review November 17, 2022 09:59
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Nov 17, 2022
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

Copy link
Copy Markdown
Member

@not-napoleon not-napoleon left a comment

Choose a reason for hiding this comment

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

This looks good to me. I think it's still good practice to get someone from Distributed to review these changes before merging though.

int i = getOffsetIndex(index);
int idx = index - offsets[i];
int end = idx + 8;
BytesReference wholeDoublesLivesHere = references[i];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy paste? Should probably be wholeLongLivesHere, I would think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, a classic copy paste error. I will change the variable name.

Copy link
Copy Markdown
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

LGTM just a few trivial points that might be nice to clean up :)

@Override
public void writeTo(StreamOutput out) throws IOException {
int size = (int) size();
out.writeVInt(size * 8);
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.

Maybe just cache size * Long.BYTES to a variable? :) Calculating it twice in two different ways back to back makes me unhappy :D


@Override
public void writeTo(StreamOutput out) throws IOException {
int size = (int) size();
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.

Maybe use Math.toIntExcact(sizze()) here to make this obviously correct?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for the review! I pushed the changes via: ebe635c

out.write(pages[i]);
}
out.write(pages[pages.length - 1], 0, lastPageEnd * Double.BYTES);
writePages(out, (int) size, pages, Double.BYTES, DOUBLE_PAGE_SIZE);
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.

Maybe use Math.toIntExcact(sizze()) here to make this obviously correct?


@Override
public void writeTo(StreamOutput out) throws IOException {
writePages(out, (int) size, pages, Long.BYTES, LONG_PAGE_SIZE);
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.

Maybe use Math.toIntExcact(sizze()) here to make this obviously correct?

@martijnvg martijnvg added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Nov 23, 2022
@martijnvg
Copy link
Copy Markdown
Member Author

@elasticmachine run elasticsearch-ci/part-2

@elasticsearchmachine elasticsearchmachine merged commit 2a33538 into elastic:main Nov 23, 2022
@martijnvg martijnvg deleted the netty_long_array branch November 23, 2022 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/Aggregations Aggregations auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants