Alexey Serbin has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/18213 )

Change subject: [common] fix function Schema::Reset(cols, ...)
......................................................................


Patch Set 6:

(5 comments)

Thank you for the patch!

http://gerrit.cloudera.org:8080/#/c/18213/6//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/18213/6//COMMIT_MSG@7
PS6, Line 7: fix function Schema::Reset(cols, ...)
How about:

fix bug in Schema::Reset(cols, ...)


http://gerrit.cloudera.org:8080/#/c/18213/6//COMMIT_MSG@9
PS6, Line 9: When I fix a tool bug (https://gerrit.cloudera.org/c/18169/),
           : I find Schema::Reset(cols, ...) seems not what we expect,
           : and in my opinion, it's a bug.
           :
           : The fixing is no confluence to all unit tests.
How about updating this a bit to describe the essence of the problem.  For 
example, something like below:

Prior to this patch, Schema::col_offsets_ was not cleared
upon calling Schema::Reset().  This patch addresses the issue.

A new test scenario is added to cover the corresponding regressions in future.


http://gerrit.cloudera.org:8080/#/c/18213/6/src/kudu/common/schema-test.cc
File src/kudu/common/schema-test.cc:

http://gerrit.cloudera.org:8080/#/c/18213/6/src/kudu/common/schema-test.cc@322
PS6, Line 322: schema.Reset(schema1.columns(), 2);
Wrap into ASSERT_OK()?


http://gerrit.cloudera.org:8080/#/c/18213/6/src/kudu/common/schema-test.cc@327
PS6, Line 327:
Could you also add an extra check below?

  ASSERT_EQ(schema.key_byte_size(), schema1.key_byte_size());


http://gerrit.cloudera.org:8080/#/c/18213/6/src/kudu/common/schema.cc
File src/kudu/common/schema.cc:

http://gerrit.cloudera.org:8080/#/c/18213/6/src/kudu/common/schema.cc@284
PS6, Line 284:   col_offsets_.reserve(cols_.size() + 1);  // Include space for 
total byte size at the end.
             :   col_offsets_.clear();
nit: consider changing the order to call vector::clear() before calling 
vector::reserve()

Even if vector::clear() should not change the capacity by the C++ standard (see 
https://en.cppreference.com/w/cpp/container/vector/clear), I think the code 
would be more straightforward if calling vector::clear() before 
vector::reserve() above.



--
To view, visit http://gerrit.cloudera.org:8080/18213
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I7a197638cbfb568d5df605ed88f0bb95926ac722
Gerrit-Change-Number: 18213
Gerrit-PatchSet: 6
Gerrit-Owner: Yuqi Du <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Yingchun Lai <[email protected]>
Gerrit-Reviewer: Yuqi Du <[email protected]>
Gerrit-Comment-Date: Mon, 14 Feb 2022 21:36:36 +0000
Gerrit-HasComments: Yes

Reply via email to