Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.

Avoid unused values materialization in ResultSet::rowCount. #654

Merged
merged 1 commit into from
Aug 26, 2023

Conversation

ienkovich
Copy link
Contributor

This is a minor optimization of a single-threaded rowCount implementation. It's not used for big result sets but still, we materialize TargetValue objects here and don't use them. Materialization can be costly for complex aggregates (like approx quanile and topK) and big varlen values.

break;
}
auto iter = rowIterator(false, false);
while (iter.isValid()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should isValid be protected by a lock?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an internal iterator object and work with it should be protected by a lock. But here I create an external iterator to avoid locks.

BTW I really don't like this internal iterator. I barely can imagine cases when we cannot use an external iterator. And we regularly had problems with this internal one. E. g. debug print of the result set moved its internal iterator to the end and then we incorrectly iterated through it in some other place. We fixed multiple cases like that previously.

@ienkovich ienkovich merged commit d2f9b98 into main Aug 26, 2023
@ienkovich ienkovich deleted the ienkovich/row-count branch August 26, 2023 21:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants