kangpinghuang commented on a change in pull request #1346: Add column reader writer for segment V2 URL: https://github.com/apache/incubator-doris/pull/1346#discussion_r296561838
########## File path: be/src/olap/rowset/segment_v2/column_reader.cpp ########## @@ -0,0 +1,330 @@ +// 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/rowset/segment_v2/column_reader.h" + +#include "env/env.h" // for RleDecoder +#include "gutil/strings/substitute.h" // for Substitute +#include "olap/rowset/segment_v2/encoding_info.h" // for EncodingInfo +#include "olap/rowset/segment_v2/page_decoder.h" // for PagePointer +#include "olap/rowset/segment_v2/page_handle.h" // for PageHandle +#include "olap/rowset/segment_v2/page_pointer.h" // for PagePointer +#include "olap/types.h" // for TypeInfo +#include "runtime/vectorized_row_batch.h" // for ColumnVectorView +#include "util/coding.h" // for get_varint32 +#include "util/rle_encoding.h" // for RleDecoder + +namespace doris { +namespace segment_v2 { + +using strings::Substitute; + +// This contains information when one page is loaded, and ready for read +// This struct can be reused, client should call reset first before reusing +// this object +struct ParsedPage { + ParsedPage() { } + ~ParsedPage() { + delete data_decoder; + } + + PagePointer page_pointer; + PageHandle page_handle; + + Slice null_bitmap; + RleDecoder<bool> null_decoder; + PageDecoder* data_decoder = nullptr; + + // first rowid for this page + rowid_t first_rowid = 0; + + // number of rows including nulls and not-nulls + uint32_t num_rows = 0; + + // current offset when read this page Review comment: Is this argument start from 0 or 1? It seems that it start from 1 here? Add some comment to describe 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]
