fix MAX_INTERMEDIATE_SIZE for DoubleMeanHolder#9568
Conversation
|
+1 after build, thanks , good catch. How did you get to this? this was really sneaky. |
jihoonson
left a comment
There was a problem hiding this comment.
Nice finding! Would you add a unit test? You can add a test method to a new class DoubleMeanAggregatorFactoryTest that verifies DoubleMeanAggregatorFactory.getMaxIntermediateSize().
|
@himanshug I found this when I was trying to figure out how to implement a module to solve this issue. In some cases, the object may turn out to be byte[] . It's right? |
|
@jihoonson Ok. I will add a test tomorrow. |
|
got it, so you were looking at the code and knew Long.SIZE wan't number of bytes but bits.
at that point we are never gonna get a byte array. |
|
Are you sure? I had an exception before I fixed a similar code (deserialize and finalizeComputation):
|
|
can you send me the druid query that reproduces behavior that of getting byte[] in doubleMean deserialize(..) ? |
|
@himanshug It can be either deserialize or finalizeComputation:
|
|
ok, can you please add the byte[] type handling in deserialize(..) and finalizeComputation(..) please. thanks |
…eMeanAggregatorFactory
…, finalizeComputation
| return DoubleMeanHolder.fromBytes(StringUtils.decodeBase64(StringUtils.toUtf8((String) object))); | ||
| } else if (object instanceof DoubleMeanHolder) { | ||
| return object; | ||
| } else if (object instanceof byte[]) { |
There was a problem hiding this comment.
can we make byte[] be the firs if check in both places ?
There was a problem hiding this comment.
But DoubleMeanHolder in both places too. Maybe we will replace only String in deserialize(..)?
There was a problem hiding this comment.
I meant, just move the byte[] check as being the first check in if-statement chain as I am expecting that would be the case most of the time.
* fix MAX_INTERMEDIATE_SIZE for DoubleMeanHolder * byte[] type handling in deserialize and finalizeComputation for DoubleMeanAggregatorFactory * DoubleMeanAggregatorFactory tests: Max Intermediate Size, Deserialize, finalizeComputation * moved byte[] check to first position Co-authored-by: Stanislav <S.Poryadnyi@abcconsulting.ru>
* fix MAX_INTERMEDIATE_SIZE for DoubleMeanHolder (#9568) * fix MAX_INTERMEDIATE_SIZE for DoubleMeanHolder * byte[] type handling in deserialize and finalizeComputation for DoubleMeanAggregatorFactory * DoubleMeanAggregatorFactory tests: Max Intermediate Size, Deserialize, finalizeComputation * moved byte[] check to first position Co-authored-by: Stanislav <S.Poryadnyi@abcconsulting.ru> * remove commons-lang3 usage from DoubleMeanAggregatorFactoryTest Co-authored-by: Stanislav Poryadnyi <37914083+aP0StAl@users.noreply.github.com> Co-authored-by: Stanislav <S.Poryadnyi@abcconsulting.ru>
Description
Fixed the bug with allocating a large amount of memory in the buffer