You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2019/08/28 18:39:21 UTC
[kudu] branch master updated: [cfile] Fix the default encoding
mappings
This is an automated email from the ASF dual-hosted git repository.
adar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new e253bb8 [cfile] Fix the default encoding mappings
e253bb8 is described below
commit e253bb88c667c8337decda188bef85898661aadb
Author: lingbin <li...@gmail.com>
AuthorDate: Tue Aug 27 14:38:24 2019 +0800
[cfile] Fix the default encoding mappings
For any data-type, the first encoding-type added to the map is
the default encoding for that data-type.
Change-Id: I646715b939a5222b8178117234d9f2acf3c550df
Reviewed-on: http://gerrit.cloudera.org:8080/14147
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>
---
src/kudu/cfile/type_encodings.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/kudu/cfile/type_encodings.cc b/src/kudu/cfile/type_encodings.cc
index 444dea1..9087ff3 100644
--- a/src/kudu/cfile/type_encodings.cc
+++ b/src/kudu/cfile/type_encodings.cc
@@ -281,10 +281,10 @@ class TypeEncodingResolver {
template<DataType type, EncodingType encoding> void AddMapping() {
TypeEncodingTraits<type, encoding> traits;
- pair<DataType, EncodingType> encoding_for_type = make_pair(type, encoding);
- if (mapping_.find(encoding_for_type) == mapping_.end()) {
- default_mapping_.emplace(type, encoding);
- }
+ // The first call to AddMapping() for a given data-type is always the default one.
+ // emplace() will no-op if the data-type is already present, so we can blindly
+ // call emplace() here(i.e. no need to call find() to check before inserting)
+ default_mapping_.emplace(type, encoding);
mapping_.emplace(make_pair(type, encoding),
unique_ptr<TypeEncodingInfo>(new TypeEncodingInfo(traits)));
}