delected commented logging code

This commit is contained in:
Nikolai Kochetov 2017-06-20 16:46:24 +03:00 committed by alexey-milovidov
parent 586dff9126
commit d14f64af7b
3 changed files with 12 additions and 31 deletions

View File

@ -109,15 +109,13 @@ Block MergeTreeBaseBlockInputStream::readFromPart()
space_left = std::min(space_left, std::max(1LU, recommended_rows)); space_left = std::min(space_left, std::max(1LU, recommended_rows));
} }
//LOG_TRACE(log, "******************* prewhere");
std::experimental::optional<MergeTreeRangeReader> pre_range_reader; std::experimental::optional<MergeTreeRangeReader> pre_range_reader;
if (task->current_range_reader) if (task->current_range_reader)
{ {
pre_range_reader = task->current_range_reader->copyForReader(*pre_reader); pre_range_reader = task->current_range_reader->copyForReader(*pre_reader);
if (task->unread_rows_in_current_granule) if (task->number_of_rows_to_skip)
{ {
// LOG_TRACE(log, "skipping " << task->unread_rows_in_current_granule << " rows"); pre_range_reader = pre_range_reader->skipRows(task->number_of_rows_to_skip);
pre_range_reader = pre_range_reader->skipRows(task->unread_rows_in_current_granule);
pre_range_reader->disableNextSeek(); pre_range_reader->disableNextSeek();
} }
rows_was_read.push_back(0); rows_was_read.push_back(0);
@ -184,7 +182,7 @@ Block MergeTreeBaseBlockInputStream::readFromPart()
/// have to read rows from last partly read granula /// have to read rows from last partly read granula
auto & range = ranges_to_read.back(); auto & range = ranges_to_read.back();
task->current_range_reader = reader->readRange(range.begin, range.end); task->current_range_reader = reader->readRange(range.begin, range.end);
task->unread_rows_in_current_granule = rows_was_read.back(); task->number_of_rows_to_skip = rows_was_read.back();
} }
else else
task->current_range_reader = std::experimental::nullopt; task->current_range_reader = std::experimental::nullopt;
@ -197,11 +195,8 @@ Block MergeTreeBaseBlockInputStream::readFromPart()
if (task->current_range_reader) if (task->current_range_reader)
{ {
if (task->unread_rows_in_current_granule) if (task->number_of_rows_to_skip)
{ skipRows(res, *task->current_range_reader, *task, task->number_of_rows_to_skip);
skipRows(res, *task->current_range_reader, *task, task->unread_rows_in_current_granule);
task->current_range_reader->read(res, task->unread_rows_in_current_granule);
}
task->current_range_reader->read(res, rows_was_read[rows_was_read_idx++]); task->current_range_reader->read(res, rows_was_read[rows_was_read_idx++]);
} }
@ -213,15 +208,14 @@ Block MergeTreeBaseBlockInputStream::readFromPart()
if (!pre_range_reader) if (!pre_range_reader)
task->current_range_reader = std::experimental::nullopt; task->current_range_reader = std::experimental::nullopt;
task->unread_rows_in_current_granule = 0; task->number_of_rows_to_skip = 0;
progressImpl({ 0, res.bytes() - pre_bytes }); progressImpl({ 0, res.bytes() - pre_bytes });
} }
else if (const auto column_vec = typeid_cast<const ColumnUInt8 *>(observed_column.get())) else if (const auto column_vec = typeid_cast<const ColumnUInt8 *>(observed_column.get()))
{ {
//LOG_TRACE(log, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>> where");
const auto & pre_filter = column_vec->getData(); const auto & pre_filter = column_vec->getData();
auto & additional_rows_to_read = task->unread_rows_in_current_granule; auto & additional_rows_to_read = task->number_of_rows_to_skip;
if (!task->current_range_reader) if (!task->current_range_reader)
additional_rows_to_read = 0; additional_rows_to_read = 0;
IColumn::Filter post_filter(pre_filter.size()); IColumn::Filter post_filter(pre_filter.size());
@ -269,7 +263,6 @@ Block MergeTreeBaseBlockInputStream::readFromPart()
if (additional_rows_to_read) if (additional_rows_to_read)
{ {
skipRows(res, range_reader, *task, additional_rows_to_read); skipRows(res, range_reader, *task, additional_rows_to_read);
// LOG_TRACE(log, "additional " << additional_rows_to_read);
} }
range_reader.read(res, rows); range_reader.read(res, rows);
additional_rows_to_read = 0; additional_rows_to_read = 0;
@ -284,8 +277,6 @@ Block MergeTreeBaseBlockInputStream::readFromPart()
} }
else else
{ {
//LOG_TRACE(log, "additional " << limit - pre_filter_pos << " rows to " << additional_rows_to_read << ", current_range_rows_read = " << current_range_rows_read);
//LOG_TRACE(log, rows_was_read_idx << ' ' << rows_was_read.size() << ' ' << pre_filter_begin_pos << ' ' << pre_filter_pos << ' ' << limit);
additional_rows_to_read += limit - pre_filter_pos; additional_rows_to_read += limit - pre_filter_pos;
current_range_rows_read += limit - pre_filter_pos; current_range_rows_read += limit - pre_filter_pos;
} }
@ -305,7 +296,6 @@ Block MergeTreeBaseBlockInputStream::readFromPart()
if (additional_rows_to_read) if (additional_rows_to_read)
{ {
skipRows(res, range_reader, *task, additional_rows_to_read); skipRows(res, range_reader, *task, additional_rows_to_read);
//LOG_TRACE(log, "additional " << additional_rows_to_read);
} }
range_reader.read(res, rows); range_reader.read(res, rows);

View File

@ -49,8 +49,8 @@ struct MergeTreeReadTask
/// used to save current range processing status /// used to save current range processing status
std::experimental::optional<MergeTreeRangeReader> current_range_reader; std::experimental::optional<MergeTreeRangeReader> current_range_reader;
/// the number of rows wasn't read by range_reader if condition in prewhere was false /// the number of rows wasn't read by range_reader if condition in prewhere was false
/// halps to skip graunule if all conditions will be aslo false /// helps to skip graunule if all conditions will be aslo false
std::size_t unread_rows_in_current_granule; std::size_t number_of_rows_to_skip;
bool isFinished() const { return mark_ranges.empty() && !current_range_reader; } bool isFinished() const { return mark_ranges.empty() && !current_range_reader; }

View File

@ -6,17 +6,12 @@ namespace DB
{ {
class MergeTreeReader; class MergeTreeReader;
// void MergeTreeReader::readRange(size_t from_mark, bool is_first_mark_in_range, size_t max_rows_to_read, Block & res);
class MergeTreeRangeReader class MergeTreeRangeReader
{ {
public: public:
size_t unreadRows() const { size_t unreadRows() const { return (last_mark - current_mark) * index_granularity - read_rows_after_current_mark; }
return (last_mark - current_mark) * index_granularity - read_rows_after_current_mark; size_t unreadRowsInCurrentGranule() const { return index_granularity - read_rows_after_current_mark; }
}
size_t unreadRowsInCurrentGranule() const {
return index_granularity - read_rows_after_current_mark;
}
size_t readRowsInCurrentGranule() const { return read_rows_after_current_mark; } size_t readRowsInCurrentGranule() const { return read_rows_after_current_mark; }
@ -27,11 +22,6 @@ public:
void disableNextSeek() { seek_to_from_mark = false; } void disableNextSeek() { seek_to_from_mark = false; }
~MergeTreeRangeReader() {
//if (last_mark != current_mark)
// LOG_ERROR(logger, "last_mark = " << last_mark << " current_mark = " << current_mark << " read_rows_after_current_mark = " << read_rows_after_current_mark);
}
MergeTreeRangeReader copyForReader(MergeTreeReader & reader); MergeTreeRangeReader copyForReader(MergeTreeReader & reader);
private: private:
@ -51,3 +41,4 @@ private:
}; };
} }