HappenLee commented on code in PR #59263:
URL: https://github.com/apache/doris/pull/59263#discussion_r3316587841
##########
be/src/storage/segment/column_reader.h:
##########
@@ -424,18 +426,82 @@ class ColumnIterator {
bool read_offset_only() const { return _read_mode ==
ReadMode::OFFSET_ONLY; }
bool read_null_map_only() const { return _read_mode ==
ReadMode::NULL_MAP_ONLY; }
+ enum class ReadingMode : int {
+ NORMAL, // default mode
+ PREDICATE,
+ LAZY
+ };
+
+ virtual void set_reading_mode(ReadingMode mode) {
+ _reading_mode = mode;
+ if (mode == ReadingMode::PREDICATE) {
+ _has_place_holder_column = false;
+ }
+ }
+
+ virtual bool need_to_read() const {
+ switch (_reading_mode) {
+ case ReadingMode::NORMAL:
+ return _reading_flag != ReadingFlag::SKIP_READING;
+ case ReadingMode::PREDICATE:
+ return _reading_flag == ReadingFlag::READING_FOR_PREDICATE;
+ case ReadingMode::LAZY:
+ return _reading_flag == ReadingFlag::NEED_TO_READ;
+ default:
+ return false;
+ }
+ }
+
+ // Whether need to read meta columns, such as null map column, offset
column.
+ bool need_to_read_meta_columns() const {
+ if (_reading_flag == ReadingFlag::SKIP_READING) {
+ return false;
+ }
+ switch (_reading_mode) {
+ case ReadingMode::NORMAL:
+ case ReadingMode::PREDICATE:
+ return true;
+ case ReadingMode::LAZY:
+ return _reading_flag != ReadingFlag::READING_FOR_PREDICATE;
+ }
+ return false;
+ }
+
+ virtual void finalize_lazy_mode(MutableColumnPtr& dst) {
+ _recovery_from_place_holder_column(dst);
+ }
+
+ virtual void set_reading_flag_recursively(ReadingFlag flag) {
set_reading_flag(flag); }
+
+ // Whether this iterator or any nested iterator has data that must be
materialized
+ // in lazy mode. Predicate-only and meta-only branches are read before
filtering and
+ // must not be re-read in the lazy phase.
+ virtual bool has_lazy_read_target() const { return _reading_flag ==
ReadingFlag::NEED_TO_READ; }
+
+ bool is_pruned() const { return _pruned; }
Review Comment:
这个判断是冗余的,如果没有被prune过,这个_column_iterators[cid]->reading_flag() ==
ColumnIterator::ReadingFlag::READING_FOR_PREDICATE && // 条件2:
是谓词列
_column_iterators[cid]->has_lazy_read_target() 这两个后续的条件不可能为true啊
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]