morningman commented on a change in pull request #1515: Add storage rowwise 
iterator
URL: https://github.com/apache/incubator-doris/pull/1515#discussion_r305617249
 
 

 ##########
 File path: be/src/olap/row_block2.cpp
 ##########
 @@ -0,0 +1,113 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "olap/row_block2.h"
+
+#include <sstream>
+
+#include "gutil/strings/substitute.h"
+#include "olap/row_cursor.h"
+#include "util/bitmap.h"
+
+using strings::Substitute;
+namespace doris {
+
+RowBlockV2::RowBlockV2(const SchemaV2& schema,
+                       uint16_t capacity, Arena* arena)
+        : _schema(schema),
+        _column_datas(_schema.num_columns(), nullptr),
+        _column_null_bitmaps(_schema.num_columns(), nullptr),
+        _capacity(capacity),
+        _num_rows(0),
+        _arena(arena) {
+    auto bitmap_size = BitmapSize(capacity);
+    int i = 0;
+    for (auto& col_schema : _schema.column_schemas()) {
+        size_t data_size = col_schema.type_info()->size() * _capacity;
+        _column_datas[i] = new uint8_t[data_size];
+
+        uint8_t* null_bitmap = nullptr;
+        if (col_schema.is_nullable()) {
+            null_bitmap = new uint8_t[bitmap_size];
+        }
+        _column_null_bitmaps[i] = null_bitmap;
+
+        i++;
+    }
+}
+
+RowBlockV2::~RowBlockV2() {
+    for (auto data : _column_datas) {
+        delete data;
+    }
+    for (auto null_bitmap : _column_null_bitmaps) {
+        delete null_bitmap;
+    }
+}
+
+Status RowBlockV2::copy_to_row_cursor(size_t row_idx, RowCursor* cursor) {
+    if (row_idx >= _num_rows) {
+        return Status::InvalidArgument(
+            Substitute("Row index is large than number rows, $0 vs $1", 
row_idx, _num_rows));
+    }
+#if 0
 
 Review comment:
   Do not forget to implement it~

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to