Skip to content

Adjust BufferAggregator.get() impls to return copies#7464

Merged
gianm merged 3 commits intoapache:masterfrom
jon-wei:fix_agg_copy
Apr 13, 2019
Merged

Adjust BufferAggregator.get() impls to return copies#7464
gianm merged 3 commits intoapache:masterfrom
jon-wei:fix_agg_copy

Conversation

@jon-wei
Copy link
Copy Markdown
Contributor

@jon-wei jon-wei commented Apr 12, 2019

Fixes #7461

This PR adjusts HllSketchBuildBufferAggregator, DoublesSketchBuildBufferAggregator, and BaseBloomFilterBufferAggregator to return on-heap copies of the aggregator's objects.

@jon-wei jon-wei added the Bug label Apr 12, 2019
@gianm
Copy link
Copy Markdown
Contributor

gianm commented Apr 12, 2019

It seems like compact() would work on UpdateDoublesSketch.

@jon-wei jon-wei added the WIP label Apr 12, 2019
* <b>Implementations must not change the position, limit or mark of the given buffer</b>
* <b>Implementations must not change the position, limit or mark of the given buffer.</b>
*
* <b>The object returned must not have any references to the given buffer (i.e., make a copy).</b>
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.

I'd include rationale for this: it's because the object returned by get may live beyond the lifetime of the underlying buffer.

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.

Added the rationale here.

@gianm gianm added this to the 0.15.0 milestone Apr 12, 2019
@jon-wei jon-wei removed the WIP label Apr 12, 2019
@jon-wei
Copy link
Copy Markdown
Contributor Author

jon-wei commented Apr 12, 2019

I updated this to use compact() and added a note on mutability of return objects for BufferAggregator.get()

Copy link
Copy Markdown
Contributor

@gianm gianm left a comment

Choose a reason for hiding this comment

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

LGTM

@gianm gianm merged commit 7d9cb69 into apache:master Apr 13, 2019
gianm pushed a commit to implydata/druid-public that referenced this pull request Apr 14, 2019
* Adjust BufferAggregator.get() impls to return copies

* Update BufferAggregator docs, more agg fixes

* Update BufferAggregator get() doc
gianm pushed a commit to implydata/druid-public that referenced this pull request Apr 14, 2019
* Adjust BufferAggregator.get() impls to return copies

* Update BufferAggregator docs, more agg fixes

* Update BufferAggregator get() doc
clintropolis pushed a commit that referenced this pull request Apr 24, 2019
* Adjust BufferAggregator.get() impls to return copies

* Update BufferAggregator docs, more agg fixes

* Update BufferAggregator get() doc
@clintropolis clintropolis modified the milestones: 0.15.0, 0.14.1 Apr 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HLLSketchBuild: Intermittent errors at query time

3 participants