impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Behm (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-4787: Optimize APPX MEDIAN() memory usage
Date Sat, 18 Feb 2017 02:34:25 GMT
Alex Behm has posted comments on this change.

Change subject: IMPALA-4787: Optimize APPX_MEDIAN() memory usage

Patch Set 4:


I'm pretty happy with this patch.
File be/src/exprs/

Line 1025:   // can fit 10 times as many samples, up to a maximum of MAX_NUM_SAMPLES. We do
update references to '10'

Line 1026:   // allocate room for MAX_NUM_SAMPLES samples up front in order to conserve memory.
in order to -> to

Line 1031:   if (new_capacity * 2 >= MAX_NUM_SAMPLES) new_capacity = MAX_NUM_SAMPLES;
DCHECK_LT(state->capacity, new_capacity);

in case someone decides to significantly muck with the sampling constants such that this can

Line 1051:   // ReservoirSamples. Initially, the array has enough room for MAX_NUM_SAMPLES
/ 1000
update to reflect the new initial size

Line 1063:   *state = ReservoirSampleState<T>();
It would be clearer what's happening if we added a constructor for ReservoirSampleState that
initializes the struct fields. Right now, it appears that num_samples and source_size could
be uninitialized.

Line 1076:       // If the container is full, increase it's size by 10x.
update 10

To view, visit
To unsubscribe, visit

Gerrit-MessageType: comment
Gerrit-Change-Id: I99adaad574d4fb0a3cf38c6cbad8b2a23df12968
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Taras Bobrovytsky <>
Gerrit-Reviewer: Alex Behm <>
Gerrit-Reviewer: Marcel Kornacker <>
Gerrit-Reviewer: Matthew Jacobs <>
Gerrit-Reviewer: Mostafa Mokhtar <>
Gerrit-Reviewer: Taras Bobrovytsky <>
Gerrit-HasComments: Yes

View raw message