You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@doris.apache.org by GitBox <gi...@apache.org> on 2019/08/05 09:35:32 UTC

[GitHub] [incubator-doris] kangpinghuang commented on a change in pull request #1577: Support Segment for BetaRowset

kangpinghuang commented on a change in pull request #1577: Support Segment for BetaRowset
URL: https://github.com/apache/incubator-doris/pull/1577#discussion_r310489881
 
 

 ##########
 File path: be/src/olap/rowset/segment_v2/segment.h
 ##########
 @@ -0,0 +1,120 @@
+// 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.
+
+#pragma once
+
+#include <cstdint>
+#include <string>
+#include <memory> // for unique_ptr
+#include <vector>
+
+#include "common/status.h" // Status
+#include "gen_cpp/segment_v2.pb.h"
+#include "olap/rowset/segment_v2/common.h" // rowid_t
+#include "olap/short_key_index.h"
+#include "olap/tablet_schema.h"
+#include "util/faststring.h"
+
+namespace doris {
+
+class RandomAccessFile;
+class SegmentGroup;
+class FieldInfo;
+class TabletSchema;
+class ShortKeyIndexDecoder;
+class Schema;
+
+namespace segment_v2 {
+
+class ColumnReader;
+class ColumnIterator;
+class SegmentIterator;
+
+// A Segment is used to represent a segment in memory format. When segment is
+// generated, it won't be modified, so this struct aimed to help read operation.
+// It will prepare all ColumnReader to create ColumnIterator as needed.
+// And user can create a SegmentIterator through new_iterator function.
+//
+// NOTE: This segment is used to a specified TabletSchema, when TabletSchema
+// is changed, this segemnt can not be used any more. For eample, after a schema
+// change finished, client should disalbe all cahced Segment for old TabletSchema.
+class Segment : public std::enable_shared_from_this<Segment> {
+public:
+    Segment(std::string fname, uint32_t segment_id,
+            const std::shared_ptr<TabletSchema>& tablet_schema,
+            size_t num_rows_per_block);
+    ~Segment();
+
+    Status open();
+
+    Status new_iterator(const Schema& schema, std::unique_ptr<SegmentIterator>* iter);
+
+    uint64_t id() const { return _segment_id; }
+
+    uint32_t num_rows() const { return _footer.num_rows(); }
+
+private:
+    friend class SegmentIterator;
+
+    Status new_column_iterator(uint32_t cid, ColumnIterator** iter);
 
 Review comment:
   ```suggestion
       Status _new_column_iterator(uint32_t cid, ColumnIterator** iter);
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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