Dan Burkert has posted comments on this change. ( http://gerrit.cloudera.org:8080/8041 )
Change subject: KUDU-2055 [part 2]: Add util to construct sorted disjoint interval list ...................................................................... Patch Set 5: (6 comments) http://gerrit.cloudera.org:8080/#/c/8041/5/src/kudu/util/sorted_disjoint_interval_list.h File src/kudu/util/sorted_disjoint_interval_list.h: http://gerrit.cloudera.org:8080/#/c/8041/5/src/kudu/util/sorted_disjoint_interval_list.h@63 PS5, Line 63: IllegalState I think IllegalArgument is more appropriate here. http://gerrit.cloudera.org:8080/#/c/8041/5/src/kudu/util/sorted_disjoint_interval_list.h@76 PS5, Line 76: overlaps s/overlaps/overlap http://gerrit.cloudera.org:8080/#/c/8041/5/src/kudu/util/sorted_disjoint_interval_list.h@79 PS5, Line 79: start->second = end->second; Shouldn't this be setting it to the larger end of the two? I think as is this would fail with a nested interval, e.g: [-------------) [------) Perhaps a missing test case? http://gerrit.cloudera.org:8080/#/c/8041/5/src/kudu/util/sorted_disjoint_interval_list.h@81 PS5, Line 81: } else { In both branches, is there a way to move the point values instead of copying? This might make a difference for long string values. http://gerrit.cloudera.org:8080/#/c/8041/5/src/kudu/util/sorted_disjoint_interval_list.h@82 PS5, Line 82: IntervalIterator cur_end = end; I think this branch should just be moving *end into *(start + 1), so I don't think a std::copy should be required. std::copy makes me nervous because it effectively turns this into an n^2 algorithm. Edit: on second thought, that move/copy should only occur if (start + 1) > end (e.g. there's a gap between start and end), otherwise that's just copying end into itself. http://gerrit.cloudera.org:8080/#/c/8041/5/src/kudu/util/sorted_disjoint_interval_list.h@94 PS5, Line 94: intervals->erase(++start, end); This might be better as if (++start != end) { intervals->erase(start, end); } -- To view, visit http://gerrit.cloudera.org:8080/8041 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I61a813c047be4882f246eaf404598e7e18fcac87 Gerrit-Change-Number: 8041 Gerrit-PatchSet: 5 Gerrit-Owner: Hao Hao <hao....@cloudera.com> Gerrit-Reviewer: Adar Dembo <a...@cloudera.com> Gerrit-Reviewer: Alexey Serbin <aser...@cloudera.com> Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com> Gerrit-Reviewer: Dan Burkert <danburk...@apache.org> Gerrit-Reviewer: David Ribeiro Alves <davidral...@gmail.com> Gerrit-Reviewer: Hao Hao <hao....@cloudera.com> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Tidy Bot Gerrit-Reviewer: Todd Lipcon <t...@apache.org> Gerrit-Comment-Date: Fri, 22 Sep 2017 18:14:08 +0000 Gerrit-HasComments: Yes