8000 Fix numeric overflow in WINDOW cost estimtation by jsteemann · Pull Request #14464 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Fix numeric overflow in WINDOW cost estimtation #14464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related 8000 emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
devel
-----

* Fix numeric overflow in AQL WINDOW node cost estimation if the number of
preceding rows was set to `unbounded`.

* Updated ArangoDB Starter to 0.15.1-preview-3.

* Added garbage collection for finished and failed Pregel conductors.
Expand Down
10 changes: 8 additions & 2 deletions arangod/Aql/WindowNode.cpp
48CA
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,14 @@ CostEstimate WindowNode::estimateCost() const {
// we never return more rows than above
CostEstimate estimate = _dependencies.at(0)->getCost();
if (_rangeVariable == nullptr) {
int64_t numRows = 1 + _bounds.numPrecedingRows() + _bounds.numFollowingRows();
estimate.estimatedCost += double(numRows * numRows) * _aggregateVariables.size();
uint64_t numRows = 1;
if ( _bounds.unboundedPreceding()) {
numRows += estimate.estimatedNrItems;
} else {
numRows += std::min<uint64_t>(estimate.estimatedNrItems, _bounds.numPrecedingRows());
}
numRows += _bounds.numFollowingRows();
estimate.estimatedCost += double(numRows) * double(numRows) * _aggregateVariables.size();
} else { // guestimate
estimate.estimatedCost += 4 * _aggregateVariables.size();
}
Expand Down
0