Skip to content

Refactor HllSketchBuildAggregatorFactory#14544

Merged
gianm merged 6 commits intoapache:masterfrom
imply-cheddar:fix-hll-aggregator
Jul 10, 2023
Merged

Refactor HllSketchBuildAggregatorFactory#14544
gianm merged 6 commits intoapache:masterfrom
imply-cheddar:fix-hll-aggregator

Conversation

@imply-cheddar
Copy link
Copy Markdown
Contributor

The usage of ColumnProcessors and HllSketchBuildColumnProcessorFactory made it very difficult to figure out what was going on from just looking at the AggregatorFactory or Aggregator code. It also didn't properly double check that you could use UTF8 ahead of time, even though it's entirely possible to validate it before trying to use it. This refactor makes keeps the general indirection that had been implemented by the Consumer<Supplier> but centralizes the decision logic and makes it easier to understand the code.

The usage of ColumnProcessors and HllSketchBuildColumnProcessorFactory
made it very difficult to figure out what was going on from just looking
at the AggregatorFactory or Aggregator code.  It also didn't properly
double check that you could use UTF8 ahead of time, even though it's
entirely possible to validate it before trying to use it.  This refactor
makes keeps the general indirection that had been implemented by
the Consumer<Supplier<HllSketch>> but centralizes the decision logic and
makes it easier to understand the code.
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. Note that this fixes a bug introduced in #11201, as illustrated by the test testEstimateStringAndDoubleAreDifferent.

@gianm gianm added the Bug label Jul 10, 2023
@gianm gianm merged commit 66cac08 into apache:master Jul 10, 2023
@gianm gianm added this to the 27.0 milestone Jul 10, 2023
@imply-cheddar imply-cheddar deleted the fix-hll-aggregator branch July 11, 2023 00:04
abhishekagarwal87 pushed a commit that referenced this pull request Jul 11, 2023
* Refactor HllSketchBuildAggregatorFactory

The usage of ColumnProcessors and HllSketchBuildColumnProcessorFactory
made it very difficult to figure out what was going on from just looking
at the AggregatorFactory or Aggregator code.  It also didn't properly
double check that you could use UTF8 ahead of time, even though it's
entirely possible to validate it before trying to use it.  This refactor
makes keeps the general indirection that had been implemented by
the Consumer<Supplier<HllSketch>> but centralizes the decision logic and
makes it easier to understand the code.

* Test fixes

* Add test that validates the types are maintained

* Add back indirection to avoid buffer calls

* Cover floats and doubles are the same thing

* Static checks
sergioferragut pushed a commit to sergioferragut/druid that referenced this pull request Jul 21, 2023
* Refactor HllSketchBuildAggregatorFactory

The usage of ColumnProcessors and HllSketchBuildColumnProcessorFactory
made it very difficult to figure out what was going on from just looking
at the AggregatorFactory or Aggregator code.  It also didn't properly
double check that you could use UTF8 ahead of time, even though it's
entirely possible to validate it before trying to use it.  This refactor
makes keeps the general indirection that had been implemented by
the Consumer<Supplier<HllSketch>> but centralizes the decision logic and
makes it easier to understand the code.

* Test fixes

* Add test that validates the types are maintained

* Add back indirection to avoid buffer calls

* Cover floats and doubles are the same thing

* Static checks
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.

2 participants