[enhancement](profile) add read columns to scanner profile (#15902)

This commit is contained in:
WenYao
2023-01-16 19:32:46 +08:00
committed by GitHub
parent d75cf756c5
commit bdec4d5ac2
3 changed files with 28 additions and 6 deletions

View File

@ -42,6 +42,13 @@ void BetaRowsetReader::reset_read_options() {
_read_options.key_ranges.clear();
}
bool BetaRowsetReader::update_profile(RuntimeProfile* profile) {
if (_iterator != nullptr) {
return _iterator->update_profile(profile);
}
return false;
}
Status BetaRowsetReader::get_segment_iterators(RowsetReaderContext* read_context,
std::vector<RowwiseIterator*>* out_iters) {
RETURN_NOT_OK(_rowset->load());

View File

@ -64,12 +64,7 @@ public:
Status get_segment_num_rows(std::vector<uint32_t>* segment_num_rows) override;
bool update_profile(RuntimeProfile* profile) override {
if (_iterator != nullptr) {
return _iterator->update_profile(profile);
}
return false;
}
bool update_profile(RuntimeProfile* profile) override;
private:
bool _should_push_down_value_predicates() const;

View File

@ -33,6 +33,20 @@ NewOlapScanner::NewOlapScanner(RuntimeState* state, NewOlapScanNode* parent, int
_tablet_schema = std::make_shared<TabletSchema>();
}
static std::string read_columns_to_string(TabletSchemaSPtr tablet_schema,
const std::vector<uint32_t>& read_columns) {
std::string read_columns_string;
read_columns_string += "[";
for (auto it = read_columns.cbegin(); it != read_columns.cend(); it++) {
if (it != read_columns.cbegin()) {
read_columns_string += ", ";
}
read_columns_string += tablet_schema->columns().at(*it).name();
}
read_columns_string += "]";
return read_columns_string;
}
Status NewOlapScanner::prepare(const TPaloScanRange& scan_range,
const std::vector<OlapScanRange*>& key_ranges,
VExprContext** vconjunct_ctx_ptr,
@ -108,6 +122,12 @@ Status NewOlapScanner::prepare(const TPaloScanRange& scan_range,
}
}
// add read columns in profile
if (_state->enable_profile()) {
_profile->add_info_string("ReadColumns",
read_columns_to_string(_tablet_schema, _return_columns));
}
return Status::OK();
}