-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-8160][SQL]Support using external sorting to run aggregate #7423
Conversation
Test build #37375 has finished for PR 7423 at commit
|
Test build #37377 has finished for PR 7423 at commit
|
@lianhuiwang This is cool, thanks for working on it. Recently, we have a refactor on aggregation (new code path), could you hold a few days until we finalize that? |
ok,@davies thanks. |
Test build #37378 has finished for PR 7423 at commit
|
* <p> | ||
* This class is not thread safe. | ||
*/ | ||
public class UnsafeAppendOnlyMap { |
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.
High-level question: why not wrap / re-use BytesToBytesMap instead of duplicating most of its code here?
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.
What are the key differences between this class and BytesToBytesMap?
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.
because BytesToBytesMap has more complex, it did memory allocation's works.
it's differences between their are UnsafeAppendOnlyMap split memory allocation and RowLocation from BytesToBytesMap.
if based on BytesToBytesMap, UnsafeFixedWidthAggregationMap should change many. if it is necessary, i can did re-use BytesToBytesMap but it need to change some code of UnsafeFixedWidthAggregationMap.
moreover, i think UnsafeExternalAggregation could replace with UnsafeFixedWidthAggregationMap.
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.
another point is we can remove UnsafeFixedWidthAggregationMap and BytesToBytesMap now, and just use UnsafeExternalAggregation. when it donot support Object schema, it do not did spills that is same as UnsafeFixedWidthAggregationMap.
i think it is better than do some changes on BytesToBytesMap and UnsafeFixedWidthAggregationMap. if it is ok, i think i can did.
@davies i think you have some opinions about it. thanks.
Test build #37484 has finished for PR 7423 at commit
|
Test build #37501 has finished for PR 7423 at commit
|
@davies @JoshRosen i will close this PR because i have created new PR #7827 based on new aggregate interface. |
according to UnsafeFixedWidthAggregationMap, this PR implement external aggregation when each task has no enough memory. firstly when memory is not enough it spills UnsafeAppendOnlyMap to disk. when inserting is finished, merge in-memory map and disk's spill files and return final aggregation value of each key.