You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2025/05/28 13:14:22 UTC

(kudu) branch master updated: [common] InitNullsBitmap --> InitNonNullBitmap

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

alexey 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 41c343ed5 [common] InitNullsBitmap --> InitNonNullBitmap
41c343ed5 is described below

commit 41c343ed510a235289ac451c9caa102c36b1c98f
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Tue May 27 18:32:25 2025 -0700

    [common] InitNullsBitmap --> InitNonNullBitmap
    
    This patch renames ContiguousRowHelper::InitNullsBitmap() into
    ContiguousRowHelper::InitNonNullBitmap() to match the semantics
    of the corresponding data.  I also took the liberty of updating
    the related code to comply with the current style guide.
    
    This is a follow-up to [1] and [2].
    
    This patch doesn't contain any functional modifications.
    
    [1] https://github.com/apache/kudu/commit/ffef96b26
    [2] https://github.com/apache/kudu/commit/9ae2421ae
    
    Change-Id: I104d6e45a8cacf0e04ca1a0918b216d44b5009d1
    Reviewed-on: http://gerrit.cloudera.org:8080/22957
    Tested-by: Alexey Serbin <al...@apache.org>
    Reviewed-by: Yifan Zhang <ch...@163.com>
---
 src/kudu/common/partial_row.cc |  4 ++--
 src/kudu/common/row.h          | 14 ++++++--------
 src/kudu/tablet/memrowset.cc   |  4 ++--
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/kudu/common/partial_row.cc b/src/kudu/common/partial_row.cc
index e7b7ebb9b..57ac3525d 100644
--- a/src/kudu/common/partial_row.cc
+++ b/src/kudu/common/partial_row.cc
@@ -74,8 +74,8 @@ KuduPartialRow::KuduPartialRow(const Schema* schema)
   OverwriteWithPattern(reinterpret_cast<char*>(row_data_),
                        row_size, "NEWNEWNEWNEWNEW");
 #endif
-  ContiguousRowHelper::InitNullsBitmap(
-    *schema_, row_data_, ContiguousRowHelper::non_null_bitmap_size(*schema_));
+  ContiguousRowHelper::InitNonNullBitmap(
+      *schema_, row_data_, ContiguousRowHelper::non_null_bitmap_size(*schema_));
 }
 
 KuduPartialRow::~KuduPartialRow() {
diff --git a/src/kudu/common/row.h b/src/kudu/common/row.h
index f040edf47..4820188bb 100644
--- a/src/kudu/common/row.h
+++ b/src/kudu/common/row.h
@@ -394,15 +394,13 @@ class ContiguousRowHelper {
     return schema.byte_size() + non_null_bitmap_size(schema);
   }
 
-  static void InitNullsBitmap(const Schema& schema, Slice& row_data) {
-    InitNullsBitmap(schema, row_data.mutable_data(), row_data.size() - schema.byte_size());
+  static void InitNonNullBitmap(const Schema& schema, Slice* row_data) {
+    DCHECK_GE(row_data->size(), schema.byte_size());
+    InitNonNullBitmap(schema, row_data->mutable_data(), row_data->size() - schema.byte_size());
   }
 
-  static void InitNullsBitmap(const Schema& schema, uint8_t *row_data, size_t bitmap_size) {
-    uint8_t *non_null_bitmap = row_data + schema.byte_size();
-    for (size_t i = 0; i < bitmap_size; ++i) {
-      non_null_bitmap[i] = 0x00;
-    }
+  static void InitNonNullBitmap(const Schema& schema, uint8_t* row_data, size_t bitmap_size) {
+    memset(row_data + schema.byte_size(), 0, bitmap_size);
   }
 
   static bool is_null(const Schema& schema, const uint8_t *row_data, size_t col_idx) {
@@ -596,7 +594,7 @@ class RowBuilder {
     CHECK(buf_) << "could not allocate " << row_size << " bytes for row builder";
     col_idx_ = 0;
     byte_idx_ = 0;
-    ContiguousRowHelper::InitNullsBitmap(*schema_, buf_, bitmap_size_);
+    ContiguousRowHelper::InitNonNullBitmap(*schema_, buf_, bitmap_size_);
   }
 
   void AddString(const Slice &slice) {
diff --git a/src/kudu/tablet/memrowset.cc b/src/kudu/tablet/memrowset.cc
index e5590acaa..f006e7820 100644
--- a/src/kudu/tablet/memrowset.cc
+++ b/src/kudu/tablet/memrowset.cc
@@ -178,10 +178,10 @@ Status MemRowSet::DebugDumpImpl(int64_t* rows_left, vector<string>* lines) {
 // points into that stack storage.
 #define DEFINE_MRSROW_ON_STACK(memrowset, varname, slice_name) \
   size_t varname##_size = sizeof(MRSRow::Header) + \
-                           ContiguousRowHelper::row_size((memrowset)->schema_nonvirtual()); \
+      ContiguousRowHelper::row_size((memrowset)->schema_nonvirtual()); \
   uint8_t varname##_storage[varname##_size]; \
   Slice slice_name(varname##_storage, varname##_size); \
-  ContiguousRowHelper::InitNullsBitmap((memrowset)->schema_nonvirtual(), slice_name); \
+  ContiguousRowHelper::InitNonNullBitmap((memrowset)->schema_nonvirtual(), &(slice_name)); \
   MRSRow varname(memrowset, slice_name);
 
 Status MemRowSet::Insert(Timestamp timestamp,