You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/05/04 13:17:48 UTC

[GitHub] [incubator-doris] HappenLee commented on a diff in pull request #9360: [Bug][stream-vec-load] Null data load do not skip the same place data

HappenLee commented on code in PR #9360:
URL: https://github.com/apache/incubator-doris/pull/9360#discussion_r864816378


##########
be/src/olap/rowset/segment_v2/column_writer.cpp:
##########
@@ -193,23 +193,43 @@ Status ColumnWriter::append_nullable(const uint8_t* is_null_bits, const void* da
     return Status::OK();
 }
 
+Status ColumnWriter::append_nullable(const uint8_t* null_map, const uint8_t** ptr,
+                                     size_t num_rows) {
+    size_t offset = 0;
+    auto next_run_step = [&]() {
+        size_t step = 1;
+        for (auto i = offset + 1; i < num_rows; ++i) {
+            if (null_map[offset] == null_map[i])
+                step++;
+            else
+                break;
+        }
+        return step;
+    };
+
+    do {
+        auto step = next_run_step();
+        if (null_map[offset]) {
+            RETURN_IF_ERROR(append_nulls(step));
+            *ptr += get_field()->size() * step;
+        } else {
+            // TODO:
+            //  1. `*ptr += get_field()->size() * step;` should do in this function, not append_data;
+            //  2. support array vectorized load and ptr offset add
+            RETURN_IF_ERROR(append_data(ptr, step));
+        }
+        offset += step;
+    } while (offset < num_rows);
+
+    return Status::OK();
+}
+
 Status ColumnWriter::append(const uint8_t* nullmap, const void* data, size_t num_rows) {
     assert(data && num_rows > 0);
+    const auto* ptr = (const uint8_t*)data;
     if (nullmap) {
-        size_t bitmap_size = BitmapSize(num_rows);
-        if (_null_bitmap.size() < bitmap_size) {

Review Comment:
   the not vectorized load still use `_null_bitmap`, we will remove it after replace the old load way



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org