This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 7cf39fe  [typo] Optimize some code comments (#8673)
7cf39fe is described below

commit 7cf39fe8859a0881b1423a9c3553aabb9582f4f3
Author: Rio <[email protected]>
AuthorDate: Mon Mar 28 10:38:10 2022 +0800

    [typo] Optimize some code comments (#8673)
---
 be/src/olap/tablet_schema.h   |  8 ++--
 be/src/olap/txn_manager.h     | 12 +++---
 be/src/olap/types.h           | 24 +++++------
 be/src/olap/version_graph.cpp | 98 +++++++++++++++++++++----------------------
 be/src/olap/wrapper_field.h   | 26 ++++++------
 5 files changed, 83 insertions(+), 85 deletions(-)

diff --git a/be/src/olap/tablet_schema.h b/be/src/olap/tablet_schema.h
index eda9c2d..4408cb4 100644
--- a/be/src/olap/tablet_schema.h
+++ b/be/src/olap/tablet_schema.h
@@ -65,9 +65,7 @@ public:
     int precision() const { return _precision; }
     int frac() const { return _frac; }
     inline bool visible() { return _visible; }
-    /**
-     * Add a sub column.
-     */
+    // Add a sub column.
     void add_sub_column(TabletColumn& sub_column);
 
     uint32_t get_subtype_count() const { return _sub_column_count; }
@@ -121,7 +119,7 @@ class TabletSchema {
 public:
     // TODO(yingchun): better to make constructor as private to avoid
     // manually init members incorrectly, and define a new function like
-    // void create_from_pb(const TabletSchemaPB& schema, TabletSchema* 
tablet_schema)
+    // void create_from_pb(const TabletSchemaPB& schema, TabletSchema* 
tablet_schema).
     TabletSchema() = default;
     void init_from_pb(const TabletSchemaPB& schema);
     void to_schema_pb(TabletSchemaPB* tablet_meta_pb);
@@ -153,7 +151,7 @@ public:
             const std::unordered_set<uint32_t>* 
tablet_columns_need_convert_null = nullptr) const;
 
 private:
-    // Only for unit test
+    // Only for unit test.
     void init_field_index_for_test();
 
     friend bool operator==(const TabletSchema& a, const TabletSchema& b);
diff --git a/be/src/olap/txn_manager.h b/be/src/olap/txn_manager.h
index 24ab6fb..691454b 100644
--- a/be/src/olap/txn_manager.h
+++ b/be/src/olap/txn_manager.h
@@ -123,11 +123,11 @@ public:
 
     void get_all_related_tablets(std::set<TabletInfo>* tablet_infos);
 
-    // just check if the txn exists
+    // Just check if the txn exists.
     bool has_txn(TPartitionId partition_id, TTransactionId transaction_id, 
TTabletId tablet_id,
                  SchemaHash schema_hash, TabletUid tablet_uid);
 
-    // get all expired txns and save them in expire_txn_map.
+    // Get all expired txns and save them in expire_txn_map.
     // This is currently called before reporting all tablet info, to avoid 
iterating txn map for every tablets.
     void build_expire_txn_map(std::map<TabletInfo, std::vector<int64_t>>* 
expire_txn_map);
 
@@ -140,7 +140,7 @@ public:
 private:
     using TxnKey = std::pair<int64_t, int64_t>; // partition_id, 
transaction_id;
 
-    // implement TxnKey hash function to support TxnKey as a key for 
unordered_map
+    // Implement TxnKey hash function to support TxnKey as a key for 
`unordered_map`.
     struct TxnKeyHash {
         template <typename T, typename U>
         size_t operator()(const std::pair<T, U>& e) const {
@@ -148,7 +148,7 @@ private:
         }
     };
 
-    // implement TxnKey equal function to support TxnKey as a key for 
unordered_map
+    // Implement TxnKey equal function to support TxnKey as a key for 
`unordered_map`.
     struct TxnKeyEqual {
         template <class T, typename U>
         bool operator()(const std::pair<T, U>& l, const std::pair<T, U>& r) 
const {
@@ -168,8 +168,8 @@ private:
 
     inline Mutex& _get_txn_lock(TTransactionId transactionId);
 
-    // insert or remove (transaction_id, partition_id) from _txn_partition_map
-    // get _txn_map_lock before calling
+    // Insert or remove (transaction_id, partition_id) from _txn_partition_map
+    // get _txn_map_lock before calling.
     void _insert_txn_partition_map_unlocked(int64_t transaction_id, int64_t 
partition_id);
     void _clear_txn_partition_map_unlocked(int64_t transaction_id, int64_t 
partition_id);
 
diff --git a/be/src/olap/types.h b/be/src/olap/types.h
index e4ec59e..8579358 100644
--- a/be/src/olap/types.h
+++ b/be/src/olap/types.h
@@ -56,16 +56,16 @@ public:
 
     virtual void deep_copy(void* dest, const void* src, MemPool* mem_pool) 
const = 0;
 
-    // See copy_row_in_memtable() in olap/row.h, will be removed in future.
-    // It is same with deep_copy() for all type except for HLL and OBJECT type
+    // See `copy_row_in_memtable()` in `olap/row.h`, will be removed in the 
future.
+    // It is same with deep_copy() for all type except for HLL and OBJECT type.
     virtual void copy_object(void* dest, const void* src, MemPool* mem_pool) 
const = 0;
 
     virtual void direct_copy(void* dest, const void* src) const = 0;
 
-    // use only in zone map to cut data
+    // Use only in zone map to cut data.
     virtual void direct_copy_may_cut(void* dest, const void* src) const = 0;
 
-    //convert and deep copy value from other type's source
+    // Convert and deep copy value from other type's source.
     virtual OLAPStatus convert_from(void* dest, const void* src, const 
TypeInfo* src_type,
                                     MemPool* mem_pool, size_t variable_len = 
0) const = 0;
 
@@ -98,8 +98,8 @@ public:
         _deep_copy(dest, src, mem_pool);
     }
 
-    // See copy_row_in_memtable() in olap/row.h, will be removed in future.
-    // It is same with deep_copy() for all type except for HLL and OBJECT type
+    // See `copy_row_in_memtable()` in olap/row.h, will be removed in the 
future.
+    // It is same with `deep_copy()` for all type except for HLL and OBJECT 
type.
     inline void copy_object(void* dest, const void* src, MemPool* mem_pool) 
const override {
         _copy_object(dest, src, mem_pool);
     }
@@ -110,7 +110,7 @@ public:
         _direct_copy_may_cut(dest, src);
     }
 
-    //convert and deep copy value from other type's source
+    // Convert and deep copy value from other type's source.
     OLAPStatus convert_from(void* dest, const void* src, const TypeInfo* 
src_type,
                             MemPool* mem_pool, size_t variable_len = 0) const 
override {
         return _convert_from(dest, src, src_type, mem_pool, variable_len);
@@ -327,7 +327,7 @@ public:
         }
 
         *base += nulls_size + src_value->length() * _item_type_info->size();
-        // direct copy item
+        // Direct copy item.
         if (_item_type_info->type() == OLAP_FIELD_TYPE_ARRAY) {
             for (uint32_t i = 0; i < src_value->length(); ++i) {
                 if (dest_value->is_null_at(i)) continue;
@@ -1044,7 +1044,7 @@ struct FieldTypeTraits<OLAP_FIELD_TYPE_CHAR> : public 
BaseFieldtypeTraits<OLAP_F
             /*
              * CHAR type is of fixed length. Size in slice can be modified
              * only if value_len is greater than the fixed length. ScanKey
-             * inputed by user may be greater than fixed length.
+             * inputted by user may be greater than fixed length.
              */
             slice->size = value_len;
         } else {
@@ -1077,7 +1077,7 @@ struct FieldTypeTraits<OLAP_FIELD_TYPE_CHAR> : public 
BaseFieldtypeTraits<OLAP_F
         l_slice->size = r_slice->size;
     }
 
-    // using field.set_to_max to set varchar/char,not here
+    // Using field.set_to_max to set varchar/char,not here.
     static void (*set_to_max)(void*);
 
     static void set_to_min(void* buf) {
@@ -1228,7 +1228,7 @@ struct FieldTypeTraits<OLAP_FIELD_TYPE_OBJECT> : public 
FieldTypeTraits<OLAP_FIE
      * in this struct has no significance
      */
 
-    // See copy_row_in_memtable() in olap/row.h, will be removed in future.
+    // See `copy_row_in_memtable()` in olap/row.h, will be removed in the 
future.
     static void copy_object(void* dest, const void* src, MemPool* mem_pool) {
         auto dst_slice = reinterpret_cast<Slice*>(dest);
         auto src_slice = reinterpret_cast<const Slice*>(src);
@@ -1266,7 +1266,7 @@ struct TypeTraits : public FieldTypeTraits<field_type> {
     static const int32_t size = sizeof(CppType);
 };
 
-// get ScalarTypeInfo at compile time for performance
+// Get ScalarTypeInfo at compile time for performance.
 template <FieldType field_type>
 inline TypeInfo* get_scalar_type_info() {
     static constexpr TypeTraits<field_type> traits;
diff --git a/be/src/olap/version_graph.cpp b/be/src/olap/version_graph.cpp
index 55c6c4d..5d7daf9 100644
--- a/be/src/olap/version_graph.cpp
+++ b/be/src/olap/version_graph.cpp
@@ -57,7 +57,7 @@ void TimestampedVersionTracker::construct_versioned_tracker(
     _next_path_id = 1;
     _construct_versioned_tracker(rs_metas);
 
-    // init _stale_version_path_map
+    // Init `_stale_version_path_map`.
     _init_stale_version_path_map(rs_metas, stale_metas);
 }
 
@@ -68,15 +68,15 @@ void 
TimestampedVersionTracker::_init_stale_version_path_map(
         return;
     }
 
-    // sort stale meta by version diff (second version - first version)
+    // Sort stale meta by version diff (second version - first version).
     std::list<RowsetMetaSharedPtr> sorted_stale_metas;
     for (auto& rs : stale_metas) {
         sorted_stale_metas.emplace_back(rs);
     }
 
-    // 1. Sort the existing rowsets by version in ascending order
+    // 1. sort the existing rowsets by version in ascending order.
     sorted_stale_metas.sort([](const RowsetMetaSharedPtr& a, const 
RowsetMetaSharedPtr& b) {
-        // compare by version diff between version.first and version.second
+        // Compare by version diff between `version.first` and 
`version.second`.
         int64_t a_diff = a->version().second - a->version().first;
         int64_t b_diff = b->version().second - b->version().first;
 
@@ -86,7 +86,7 @@ void TimestampedVersionTracker::_init_stale_version_path_map(
         } else if (diff > 0) {
             return false;
         }
-        // when the version diff is equal, compare rowset create time
+        // When the version diff is equal, compare the rowset`s create time
         return a->creation_time() < b->creation_time();
     });
 
@@ -95,22 +95,22 @@ void 
TimestampedVersionTracker::_init_stale_version_path_map(
 
     // 2. generate stale path from stale_metas. traverse sorted_stale_metas 
and each time add stale_meta to stale_map.
     // when a stale path in stale_map can replace stale_meta in 
sorted_stale_metas, stale_map remove rowset_metas of a stale path
-    // and add the path to _stale_version_path_map.
+    // and add the path to `_stale_version_path_map`.
     for (auto& stale_meta : sorted_stale_metas) {
         std::vector<RowsetMetaSharedPtr> stale_path;
-        // 2.1 find a path in stale_map can replace current stale_meta version
+        // 2.1 find a path in `stale_map` can replace current `stale_meta` 
version.
         bool r = _find_path_from_stale_map(stale_map, 
stale_meta->start_version(),
                                            stale_meta->end_version(), 
&stale_path);
 
-        // 2.2 add version to version_graph
+        // 2.2 add version to `version_graph`.
         Version stale_meta_version = stale_meta->version();
         add_version(stale_meta_version);
 
-        // 2.3 find the path
+        // 2.3 find the path.
         if (r) {
-            // add the path to _stale_version_path_map
+            // Add the path to `_stale_version_path_map`.
             add_stale_path_version(stale_path);
-            // remove stale_path from stale_map
+            // Remove `stale_path` from `stale_map`.
             for (auto stale_item : stale_path) {
                 
stale_map[stale_item->start_version()].erase(stale_item->end_version());
 
@@ -120,7 +120,7 @@ void 
TimestampedVersionTracker::_init_stale_version_path_map(
             }
         }
 
-        // 2.4 add stale_meta to stale_map
+        // 2.4 add `stale_meta` to `stale_map`.
         auto start_iter = stale_map.find(stale_meta->start_version());
         if (start_iter != stale_map.end()) {
             start_iter->second[stale_meta->end_version()] = stale_meta;
@@ -131,18 +131,18 @@ void 
TimestampedVersionTracker::_init_stale_version_path_map(
         }
     }
 
-    // 3. generate stale path from rs_metas
+    // 3. generate stale path from `rs_metas`.
     for (auto& stale_meta : rs_metas) {
         std::vector<RowsetMetaSharedPtr> stale_path;
-        // 3.1 find a path in stale_map can replace current stale_meta version
+        // 3.1 find a path in stale_map can replace current `stale_meta` 
version.
         bool r = _find_path_from_stale_map(stale_map, 
stale_meta->start_version(),
                                            stale_meta->end_version(), 
&stale_path);
 
-        // 3.2 find the path
+        // 3.2 find the path.
         if (r) {
-            // add the path to _stale_version_path_map
+            // Add the path to `_stale_version_path_map`.
             add_stale_path_version(stale_path);
-            // remove stale_path from stale_map
+            // Remove `stale_path` from `stale_map`.
             for (auto stale_item : stale_path) {
                 
stale_map[stale_item->start_version()].erase(stale_item->end_version());
 
@@ -153,12 +153,12 @@ void 
TimestampedVersionTracker::_init_stale_version_path_map(
         }
     }
 
-    // 4. process remain stale rowset_meta in stale_map
+    // 4. process remain stale `rowset_meta` in `stale_map`.
     auto map_iter = stale_map.begin();
     while (map_iter != stale_map.end()) {
         auto second_iter = map_iter->second.begin();
         while (second_iter != map_iter->second.end()) {
-            // each remain stale rowset_meta generate a stale path
+            // Each remain stale `rowset_meta` generate a stale path.
             std::vector<RowsetMetaSharedPtr> stale_path;
             stale_path.push_back(second_iter->second);
             add_stale_path_version(stale_path);
@@ -175,36 +175,36 @@ bool TimestampedVersionTracker::_find_path_from_stale_map(
         int64_t first_version, int64_t second_version,
         std::vector<RowsetMetaSharedPtr>* stale_path) {
     auto first_iter = stale_map.find(first_version);
-    // if first_version not in stale_map, there is no path.
+    // If `first_version` not in `stale_map`, there is no path.
     if (first_iter == stale_map.end()) {
         return false;
     }
     auto& second_version_map = first_iter->second;
     auto second_iter = second_version_map.find(second_version);
-    // if second_version in stale_map, find a path.
+    // If second_version in `stale_map`, find a path.
     if (second_iter != second_version_map.end()) {
         auto row_meta = second_iter->second;
-        // add rowset to path
+        // Add rowset to path.
         stale_path->push_back(row_meta);
         return true;
     }
 
-    // traverse the first version map to backtracking _find_path_from_stale_map
+    // Traverse the first version map to backtracking  
`_find_path_from_stale_map`.
     auto map_iter = second_version_map.begin();
     while (map_iter != second_version_map.end()) {
-        // the version greater than second_version, we can't find path in 
stale_map
+        // The version greater than `second_version`, we can't find path in 
`stale_map`.
         if (map_iter->first > second_version) {
             map_iter++;
             continue;
         }
-        // backtracking _find_path_from_stale_map find from map_iter->first + 
1 to second_version
+        // Backtracking `_find_path_from_stale_map` find from `map_iter->first 
+ 1` to `second_version`.
         stale_path->push_back(map_iter->second);
         bool r = _find_path_from_stale_map(stale_map, map_iter->first + 1, 
second_version,
                                            stale_path);
         if (r) {
             return true;
         }
-        // there is no path in current version, pop and continue
+        // There is no path in current version, pop and continue.
         stale_path->pop_back();
         map_iter++;
     }
@@ -215,20 +215,20 @@ bool TimestampedVersionTracker::_find_path_from_stale_map(
 void 
TimestampedVersionTracker::get_stale_version_path_json_doc(rapidjson::Document& 
path_arr) {
     auto path_arr_iter = _stale_version_path_map.begin();
 
-    // do loop version path
+    // Do loop version path.
     while (path_arr_iter != _stale_version_path_map.end()) {
         auto path_id = path_arr_iter->first;
         auto path_version_path = path_arr_iter->second;
 
         rapidjson::Document item;
         item.SetObject();
-        // add path_id to item
+        // Add `path_id` to item.
         auto path_id_str = std::to_string(path_id);
         rapidjson::Value path_id_value;
         path_id_value.SetString(path_id_str.c_str(), path_id_str.length(), 
path_arr.GetAllocator());
         item.AddMember("path id", path_id_value, path_arr.GetAllocator());
 
-        // add max create time to item
+        // Add max create time to item.
         auto time_zone = cctz::local_time_zone();
 
         auto tp = 
std::chrono::system_clock::from_time_t(path_version_path->max_create_time());
@@ -239,7 +239,7 @@ void 
TimestampedVersionTracker::get_stale_version_path_json_doc(rapidjson::Docum
                                     path_arr.GetAllocator());
         item.AddMember("last create time", create_time_value, 
path_arr.GetAllocator());
 
-        // add path list to item
+        // Add path list to item.
         std::stringstream path_list_stream;
         path_list_stream << path_id_str;
         auto path_list_ptr = path_version_path->timestamped_versions();
@@ -258,7 +258,7 @@ void 
TimestampedVersionTracker::get_stale_version_path_json_doc(rapidjson::Docum
         path_list_value.SetString(path_list.c_str(), path_list.length(), 
path_arr.GetAllocator());
         item.AddMember("path list", path_list_value, path_arr.GetAllocator());
 
-        // add item to path_arr
+        // Add item to `path_arr`.
         path_arr.PushBack(item, path_arr.GetAllocator());
 
         path_arr_iter++;
@@ -268,9 +268,9 @@ void 
TimestampedVersionTracker::get_stale_version_path_json_doc(rapidjson::Docum
 void TimestampedVersionTracker::recover_versioned_tracker(
         const std::map<int64_t, PathVersionListSharedPtr>& 
stale_version_path_map) {
     auto _path_map_iter = stale_version_path_map.begin();
-    // recover stale_version_path_map
+    // Recover `stale_version_path_map`.
     while (_path_map_iter != stale_version_path_map.end()) {
-        // add PathVersionListSharedPtr to map
+        // Add `PathVersionListSharedPtr` to map.
         _stale_version_path_map[_path_map_iter->first] = 
_path_map_iter->second;
 
         std::vector<TimestampedVersionSharedPtr>& timestamped_versions =
@@ -278,7 +278,7 @@ void TimestampedVersionTracker::recover_versioned_tracker(
         std::vector<TimestampedVersionSharedPtr>::iterator version_path_iter =
                 timestamped_versions.begin();
         while (version_path_iter != timestamped_versions.end()) {
-            // add version to _version_graph
+            // Add version to `_version_graph`.
             
_version_graph.add_version_to_graph((*version_path_iter)->version());
             ++version_path_iter;
         }
@@ -318,7 +318,7 @@ void TimestampedVersionTracker::add_stale_path_version(
     _next_path_id++;
 }
 
-// Capture consistent versions from graph
+// Capture consistent versions from graph.
 OLAPStatus TimestampedVersionTracker::capture_consistent_versions(
         const Version& spec_version, std::vector<Version>* version_path) const 
{
     return _version_graph.capture_consistent_versions(spec_version, 
version_path);
@@ -402,7 +402,7 @@ double TimestampedVersionTracker::get_orphan_vertex_ratio() 
{
 }
 
 void 
TimestampedVersionPathContainer::add_timestamped_version(TimestampedVersionSharedPtr
 version) {
-    // compare and refresh _max_create_time
+    // Compare and refresh `_max_create_time`.
     if (version->get_create_time() > _max_create_time) {
         _max_create_time = version->get_create_time();
     }
@@ -433,8 +433,8 @@ void VersionGraph::construct_version_graph(const 
std::vector<RowsetMetaSharedPtr
     }
     std::sort(vertex_values.begin(), vertex_values.end());
 
-    // Items in vertex_values are sorted, but not unique.
-    // we choose unique items in vertex_values to create vertexes.
+    // Items in `vertex_values` are sorted, but not unique.
+    // we choose unique items in `vertex_values` to create vertexes.
     int64_t last_vertex_value = -1;
     for (size_t i = 0; i < vertex_values.size(); ++i) {
         if (i != 0 && vertex_values[i] == last_vertex_value) {
@@ -448,12 +448,12 @@ void VersionGraph::construct_version_graph(const 
std::vector<RowsetMetaSharedPtr
     // Create edges for version graph according to TabletMeta's versions.
     for (size_t i = 0; i < rs_metas.size(); ++i) {
         // Versions in header are unique.
-        // We ensure _vertex_index_map has its start_version.
+        // We ensure `_vertex_index_map` has its `start_version`.
         int64_t start_vertex_index = 
_vertex_index_map[rs_metas[i]->start_version()];
         int64_t end_vertex_index = 
_vertex_index_map[rs_metas[i]->end_version() + 1];
-        // Add one edge from start_version to end_version.
+        // Add one edge from `start_version` to `end_version`.
         _version_graph[start_vertex_index].edges.push_front(end_vertex_index);
-        // Add reverse edge from end_version to start_version.
+        // Add reverse edge from `end_version` to `start_version`.
         _version_graph[end_vertex_index].edges.push_front(start_vertex_index);
     }
 
@@ -486,7 +486,7 @@ void VersionGraph::add_version_to_graph(const Version& 
version) {
     int64_t end_vertex_index = _vertex_index_map[end_vertex_value];
 
     // We assume this version is new version, so we just add two edges
-    // into version graph. add one edge from start_version to end_version
+    // into version graph. add one edge from `start_version` to `end_version`
     // Make sure the vertex's edges are sorted by version in descending order 
when inserting.
     auto end_vertex_it = _version_graph[start_vertex_index].edges.begin();
     while (end_vertex_it != _version_graph[start_vertex_index].edges.end()) {
@@ -542,9 +542,8 @@ OLAPStatus VersionGraph::delete_version_from_graph(const 
Version& version) {
         end_edges_iter++;
     }
 
-    // Here we do not delete vertex in _version_graph even if its edges are 
empty.
-    // the _version_graph will be rebuilt when doing trash sweep.
-
+    // Here we do not delete vertex in `_version_graph` even if its edges are 
empty.
+    // the `_version_graph` will be rebuilt when doing trash sweep.
     return OLAP_SUCCESS;
 }
 
@@ -585,7 +584,7 @@ OLAPStatus VersionGraph::capture_consistent_versions(const 
Version& spec_version
     while (_version_graph[cur_idx].value < end_value) {
         int64_t next_idx = -1;
         for (const auto& it : _version_graph[cur_idx].edges) {
-            // Only consider incremental versions
+            // Only consider incremental versions.
             if (_version_graph[it].value < _version_graph[cur_idx].value) {
                 break;
             }
@@ -595,14 +594,15 @@ OLAPStatus 
VersionGraph::capture_consistent_versions(const Version& spec_version
             }
 
             // Considering edges had been sorted by version in descending 
order,
-            // This version is the largest version that smaller than 
end_version.
+            // This version is the largest version that smaller than 
`end_version`.
             next_idx = it;
             break;
         }
 
         if (next_idx > -1) {
             if (version_path != nullptr) {
-                version_path->emplace_back(_version_graph[cur_idx].value, 
_version_graph[next_idx].value - 1);
+                version_path->emplace_back(_version_graph[cur_idx].value,
+                                           _version_graph[next_idx].value - 1);
             }
             cur_idx = next_idx;
         } else {
@@ -632,7 +632,7 @@ double VersionGraph::get_orphan_vertex_ratio() {
             ++orphan_vertex_num;
         }
     }
-    return orphan_vertex_num / (double) vertex_num;
+    return orphan_vertex_num / (double)vertex_num;
 }
 
 } // namespace doris
diff --git a/be/src/olap/wrapper_field.h b/be/src/olap/wrapper_field.h
index 51e4b3e..494f94a 100644
--- a/be/src/olap/wrapper_field.h
+++ b/be/src/olap/wrapper_field.h
@@ -34,8 +34,8 @@ public:
 
     WrapperField(Field* rep, size_t variable_len, bool is_string_type);
 
-    // only used to wrapped content of row cursor cell to find element in 
wrapped field set
-    // do not delete rep, should call release_field before deconstructed
+    // Only used to wrapped content of row cursor cell to find element in 
wrapped field set
+    // do not delete rep, should call release_field before deconstructed.
     WrapperField(Field* rep, const RowCursorCell& row_cursor_cell);
 
     virtual ~WrapperField() {
@@ -46,14 +46,14 @@ public:
         }
     }
 
-    // 将内部的value转成string输出
-    // 没有考虑实现的性能,仅供DEBUG使用
-    // do not include the null flag
+    // Convert the internal value to string output.
+    //
+    // NOTE: it only for DEBUG use. Do not include the null flag.
     std::string to_string() const { return _rep->to_string(_field_buf + 1); }
 
-    // 从传入的字符串反序列化field的值
-    // 参数必须是一个\0结尾的字符串
-    // do not include the null flag
+    // Deserialize field value from incoming string.
+    //
+    // NOTE: the parameter must be a '\0' terminated string. It do not include 
the null flag.
     OLAPStatus from_string(const std::string& value_string) {
         if (_is_string_type) {
             if (value_string.size() > _var_length) {
@@ -67,11 +67,11 @@ public:
         return _rep->from_string(_field_buf + 1, value_string);
     }
 
-    // attach到一段buf
+    // Attach to a buf.
     void attach_buf(char* buf) {
         _field_buf = _owned_buf;
 
-        // set null byte
+        // Set null byte.
         *_field_buf = 0;
         memcpy(_field_buf + 1, buf, size());
     }
@@ -94,7 +94,7 @@ public:
     void* mutable_cell_ptr() const { return _field_buf + 1; }
     const Field* field() const { return _rep; }
 
-    // should be only called by WrapperField which constructed by RowCursorCell
+    // Should be only called by 'WrapperField' which constructed by 
'RowCursorCell'.
     void release_field() { _rep = nullptr; }
 
     int cmp(const WrapperField* field) const { return 
_rep->compare_cell(*this, *field); }
@@ -108,10 +108,10 @@ private:
     char* _owned_buf = nullptr;
     char* _long_text_buf = nullptr;
 
-    //include fixed and variable length and null bytes
+    // Include fixed and variable length and null bytes.
     size_t _length;
     size_t _var_length;
-    // memory for string type field
+    // Memory for string type field.
     std::unique_ptr<char[]> _string_content;
 };
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to