Hello Dan Burkert, Jean-Daniel Cryans, I'd like you to do a code review. Please visit
http://gerrit.cloudera.org:8080/5031 to review the following change. Change subject: KUDU-180. Fix handling of defaults when creating tables ...................................................................... KUDU-180. Fix handling of defaults when creating tables This fixes an issue that was experienced when creating tables from the Java client when those tables had a column with a default value. Previously, the client would send the default value as the 'read_default' protobuf field, and the server would just write that default into the table schema. This would result in the write_default being left unset, and thus insertions which did not specify the column would insert NULL rather than inserting the column's default. This didn't affect tables created from the C++ API, because the C++ client set both the read and write default fields when creating a table. Because the separation of "read" and "write" defaults is an internal concept, we shouldn't really have exposed it in the client-facing protobuf in the first place. Unfortunately, that ship sailed long ago and the same protobuf is used internally as is used in the client-facing wire protocol, and changing it now would be a huge amount of work to do without breaking compatibility. Thus, the fix here is to document that the server will only look at the "read_default" field sent by the client when adding columns. The server then propagates this field as the initial write_default for any newly-added columns. A new test is added in Java which reproduced the issue but now passes. Change-Id: Ia76c7cb599292fac4d7a8edf163d59a1574e897b --- M java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduClient.java M src/kudu/client/client.cc M src/kudu/client/table_alterer-internal.cc M src/kudu/common/common.proto M src/kudu/common/wire_protocol.cc M src/kudu/common/wire_protocol.h M src/kudu/master/catalog_manager.cc M src/kudu/master/master-test.cc 8 files changed, 195 insertions(+), 39 deletions(-) git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/31/5031/1 -- To view, visit http://gerrit.cloudera.org:8080/5031 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia76c7cb599292fac4d7a8edf163d59a1574e897b Gerrit-PatchSet: 1 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Todd Lipcon <t...@apache.org> Gerrit-Reviewer: Dan Burkert <danburk...@apache.org> Gerrit-Reviewer: Jean-Daniel Cryans <jdcry...@apache.org>