impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Ho (Code Review)" <ger...@cloudera.org>
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:

(9 comments)

http://gerrit.cloudera.org:8080/#/c/5776/8/be/src/exprs/string-functions-ir.cc
File be/src/exprs/string-functions-ir.cc:

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 http://gerrit.cloudera.org:8080/5776
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I1780a7d8fee6d0db9dad148217fb6eb10f773329
Gerrit-PatchSet: 8
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Zach Amsden <zamsden@cloudera.com>
Gerrit-Reviewer: Alex Behm <alex.behm@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dhecht@cloudera.com>
Gerrit-Reviewer: Michael Ho <kwho@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <tarmstrong@cloudera.com>
Gerrit-Reviewer: Zach Amsden <zamsden@cloudera.com>
Gerrit-HasComments: Yes

Mime
View raw message