-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 emails.
Already on GitHub? Sign in to your account
Introduce resultSize in IndexedTable #7420
Introduce resultSize in IndexedTable #7420
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7420 +/- ##
============================================
- Coverage 71.87% 70.61% -1.27%
Complexity 3347 3347
============================================
Files 1517 1517
Lines 75039 75040 +1
Branches 10921 10930 +9
============================================
- Hits 53932 52987 -945
- Misses 17482 18430 +948
+ Partials 3625 3623 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
b504c02
to
ced0dad
Compare
How is this evaluated? Is it repeatable? |
@richardstartin This is repeatable for all group-by order-by queries without having clause (having clause has other issues, and I just put a TODO and keep the current behavior). For example, currently when we do |
_hasOrderBy = false; | ||
_tableResizer = null; | ||
_trimSize = trimSize; | ||
_trimThreshold = trimSize; | ||
_trimSize = Integer.MAX_VALUE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For group by without order by cases, why not use the value from limit clause as the trimSize?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no trim required for cases without order-by, so trim size and trim threshold doesn't really matter
Introduce resultSize (number of records kept after calling finish()) in IndexedTable which can be different from the trimSize.
On the broker side, we only need to keep limit records in the final result because the groups are already fully merged. This can significantly reduce the cost of final record sorting.
Also separate the logic for queries with/without order-by and move the common methods into the IndexedTable to reduce the duplicate code.