Michael Ho has posted comments on this change. Change subject: IMPALA-4729: Implement REPLACE() ......................................................................
Patch Set 2: (5 comments) http://gerrit.cloudera.org:8080/#/c/5776/2/be/src/exprs/string-functions-ir.cc File be/src/exprs/string-functions-ir.cc: PS2, Line 221: // First pass - find matches to compute output size A high level question: for very long string, is a two pass algorithm better than a one pass approach in which one just keep appending to the result string as we find matches in the haystack string. PS2, Line 237: int rlen = num_matches * (replace.len - needle.len) + str.len; Can this overflow with a malicious replacement string ? PS2, Line 249: DCHECK(match_pos_in_substring >= 0); DCHECK_GE() http://gerrit.cloudera.org:8080/#/c/5776/2/fe/src/main/cup/sql-parser.cup File fe/src/main/cup/sql-parser.cup: PS2, Line 2955: ident_or_restricted:ident Not sure if dotted_path is the right place to modify as it's used at other places too. Ideally we should limit "replace" to be accepted as function_names only but not for say database / table / column names. PS2, Line 3050: ident_or_restricted May want to hide this as function_name's definition only to avoid others from using it if possible. -- 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: 2 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Zach Amsden <[email protected]> Gerrit-Reviewer: Alex Behm <[email protected]> Gerrit-Reviewer: Dan Hecht <[email protected]> Gerrit-Reviewer: Michael Ho <[email protected]> Gerrit-HasComments: Yes
