impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Taras Bobrovytsky (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-4787: Optimize APPX MEDIAN() memory usage
Date Tue, 07 Mar 2017 21:44:54 GMT
Taras Bobrovytsky has posted comments on this change.

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

Patch Set 13:

File be/src/exprs/

PS13, Line 1075:     capacity_ = num_samples_;
               :     sample_array_inline_ = true;
> as we discussed in person, let's move this to serialize which is when this 

PS13, Line 1091:         int target_capacity = INIT_CAPACITY;
               :         while (target_capacity < necessary_capacity) target_capacity *=
> BitUtil::RoundUpToPowerOfTwo

PS13, Line 1093:         if (target_capacity > MAX_CAPACITY) target_capacity = MAX_CAPACITY;
               :         bool result = IncreaseCapacity(ctx, target_capacity);
> this is simplified if IncreaseCapacity takes the max and handles the ceilin
Done. IncreaseCapacity() handles the ceiling.

PS13, Line 1163: may
> may be

PS13, Line 1168:   // if it hasn't been allocated yet. Returns false if the operation fails.
               :   bool IncreaseCapacity(FunctionContext* ctx, int new_capacity) {
> If you change this to take max_capacity (which always should pass the const
I made some changes. I am not sure if it makes sense to pass max_capacity as a parameter,
but the ceiling is calculated here as you suggested. Let me know if my change makes sense
to you.

To view, visit
To unsubscribe, visit

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

View raw message