taiyang-li commented on code in PR #2048:
URL: https://github.com/apache/orc/pull/2048#discussion_r1796357509


##########
c++/src/Reader.cc:
##########
@@ -1474,6 +1476,77 @@ namespace orc {
     return ret;
   }
 
+  void ReaderImpl::releaseBuffer(uint64_t boundary) {
+    if (cachedSource_) {
+      cachedSource_->evictEntriesBefore(boundary);
+    }
+  }
+
+  void ReaderImpl::preBuffer(const std::vector<int>& stripes,
+                             const std::list<uint64_t>& includeTypes, const 
CacheOptions& options) {
+    if (stripes.empty() || includeTypes.empty()) {
+      return;
+    }
+
+    orc::RowReaderOptions row_reader_options;
+    row_reader_options.includeTypes(includeTypes);
+    ColumnSelector column_selector(contents_.get());
+    std::vector<bool> selected_columns;
+    column_selector.updateSelected(selected_columns, row_reader_options);
+
+    std::vector<ReadRange> ranges;

Review Comment:
   Single include type may correspond to serveral ranges for complex type or 
dict type. By calling `ranges.reserve(includeTypes.size());`, we give `ranges` 
an initial capacity to avoid too much realloc. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to