You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "AshinGau (via GitHub)" <gi...@apache.org> on 2023/04/20 06:41:12 UTC

[GitHub] [doris] AshinGau commented on a diff in pull request #18796: [opt](FileReader) merge small IO to optimize read performace

AshinGau commented on code in PR #18796:
URL: https://github.com/apache/doris/pull/18796#discussion_r1172144890


##########
be/src/vec/exec/format/parquet/vparquet_reader.cpp:
##########
@@ -581,6 +582,42 @@ Status ParquetReader::_init_row_groups(const bool& is_filter_groups) {
     return Status::OK();
 }
 
+std::vector<io::PrefetchRange> ParquetReader::_generate_random_access_ranges(
+        const RowGroupReader::RowGroupIndex& group) {
+    std::vector<io::PrefetchRange> result;
+    int64_t last_chunk_end = -1;
+    std::function<void(const FieldSchema*, const tparquet::RowGroup&)> scalar_range =
+            [&](const FieldSchema* field, const tparquet::RowGroup& row_group) {
+                if (field->type.type == TYPE_ARRAY) {
+                    scalar_range(&field->children[0], row_group);
+                } else if (field->type.type == TYPE_MAP) {
+                    scalar_range(&field->children[0].children[0], row_group);
+                    scalar_range(&field->children[0].children[1], row_group);
+                } else if (field->type.type == TYPE_STRUCT) {
+                    for (int i = 0; i < field->children.size(); ++i) {
+                        scalar_range(&field->children[i], row_group);
+                    }
+                } else {
+                    const tparquet::ColumnChunk& chunk =
+                            row_group.columns[field->physical_column_index];
+                    auto& chunk_meta = chunk.meta_data;
+                    int64_t chunk_start = chunk_meta.__isset.dictionary_page_offset
+                                                  ? chunk_meta.dictionary_page_offset
+                                                  : chunk_meta.data_page_offset;
+                    int64_t chunk_end = chunk_start + chunk_meta.total_compressed_size;
+                    DCHECK_GE(chunk_start, last_chunk_end);

Review Comment:
   In `_init_read_columns()`, the columns are sorted by physical column order.



-- 
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