impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Ho (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-4729: Implement REPLACE()
Date Wed, 01 Feb 2017 01:25:47 GMT
Michael Ho has posted comments on this change.

Change subject: IMPALA-4729: Implement REPLACE()

Patch Set 8:

File be/src/exprs/

PS8, Line 236: (UNLIKELY(result.is_null))
May help to add a comment stating that result can be null if buffer_space exceeds StringVal::MAX_LENGTH
at this point.

PS8, Line 242: bytes
may be this can use a more meaningful name such as unmatched_len.

PS8, Line 257: check_space)
We want to skip this doubling behavior if bytes_remaining == 0.

The code could be slightly simpler if we avoid having check_space and directly check the size
of the buffer_space (like line 260). The branch should be pretty predictable for the case
in which the replacement string is shorter than the pattern string.

PS8, Line 260: replace.len
nit: replace.len - pattern.len ?

PS8, Line 265:  std::numeric_limits<decltype(buffer_space)>::max() / 2);
nit: indent 4.

PS8, Line 267:  ptr - result.ptr
Isn't this bytes_produced ?

PS8, Line 268: if (UNLIKELY(!result.Resize(context, buffer_space))) {
A one line comment about this already handles case in which the buffer_space exceeds StringVal::MAX_LENGTH

PS8, Line 282: remaining_bytes
'bytes_remaining' for consistency with the code above.

PS8, Line 289: context->Reallocate
As discussed in person, this will not shrink the buffer given the way FreePool::Reallocate()
is implemented.

To view, visit
To unsubscribe, visit

Gerrit-MessageType: comment
Gerrit-Change-Id: I1780a7d8fee6d0db9dad148217fb6eb10f773329
Gerrit-PatchSet: 8
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Zach Amsden <>
Gerrit-Reviewer: Alex Behm <>
Gerrit-Reviewer: Dan Hecht <>
Gerrit-Reviewer: Michael Ho <>
Gerrit-Reviewer: Tim Armstrong <>
Gerrit-Reviewer: Zach Amsden <>
Gerrit-HasComments: Yes

View raw message