-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-24978][SQL]Add spark.sql.fast.hash.aggregate.row.max.capacity to configure the capacity of fast aggregation. #21931
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
Conversation
|
@heary-cao, thanks! I am a bot who has found some folks who might be able to help with the review:@rxin, @cloud-fan and @yhuai |
|
What does the benchmark result suggest? The result should be |
|
@maropu, The test results show that we can make a configuration parameter for the capacity of fast hash. Currently capacity of our fast hash is related to the length of the recorded data. so I'm not sure how much the default value is configured, but it is unreasonable to configure it in CodeGen as a fixed value(int capacity = 1 << 16;). |
|
cc @maropu |
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.
We can see the following code at L226. If a user specify 2^n value (e.g. 1024), it works functionally correct. What happens if a user specified non 2^n value (e.g. 127)?
idx = (idx + 1) & (numBuckets - 1);
7f40697 to
1428309
Compare
|
@kiszk, Thank you for your suggestion. I have update it. Can you review it again if you have some time. thanks. |
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.
We need to accept these small values, e.g., 2^1, 2^2, ..? I think these are meaningless...
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.
This name looks too long. How about spark.sql.codegen.aggregate.map.row.capacitybit or others?
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.
Can we describe something about this value? (e.g. bit not for value). Precisely, the actual numBuckets is determined by loadFactor, too.
Can we describe about the default value?
|
Does this work when we set |
9984931 to
78cd048
Compare
|
@kiszk ,I'm not sure how much the maximum is set, and the size of 1G is the maximum value accepted by numBuckets. Of course, buckets is the memory of 8G. |
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.
nit: 1 >> 16 -> 1 << 16
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.
nit: we need to reduce # of characters per line up to 100. IIUC, the number is more than 100.
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.
spark.sql.codegen.aggregate.fastHashMap.capacityBit?
78cd048 to
94f98ed
Compare
|
@kiszk , @cloud-fan |
|
LGTM, cc @cloud-fan @hvanhovell |
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.
the bit -> The bit is.
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.
"fasthash = 20"?
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.
"fasthash = 16"?
|
Minor comments. LGTM. |
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.
Benchmark("Capacity for fast hash aggregate")
eb05b02 to
5ed0fda
Compare
|
ok to test |
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.
why add it?
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.
I'm sorry, update it. thanks.
|
Test build #95107 has finished for PR 21931 at commit
|
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.
I don't see why we need to add benchmark, we just make the capacity configurable.
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.
can you explain how to calculate this valid range?
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.
I am not sure about the minimum value. The initial configuration is 1. but I agree with @maropu suggestion. e.g., 2^1, 2^2,these are meaningless.
for the maximum is 30, because the integer bit is 31 and the actual numBuckets in fast hash map are determined by loadFactor and loadFactor is 0.5 too.
code is:
private double loadFactor = 0.5;
private int numBuckets = (int) (capacity / loadFactor);
5ed0fda to
03c0a80
Compare
|
Test build #95154 has finished for PR 21931 at commit
|
03c0a80 to
af2078c
Compare
|
Test build #95157 has finished for PR 21931 at commit
|
af2078c to
6abeb06
Compare
|
Test build #95190 has finished for PR 21931 at commit
|
|
LGTM |
|
LGTM again |
|
thanks, merging to master! |
… to configure the capacity of fast aggregation. ## What changes were proposed in this pull request? this pr add a configuration parameter to configure the capacity of fast aggregation. Performance comparison: ``` Java HotSpot(TM) 64-Bit Server VM 1.8.0_60-b27 on Windows 7 6.1 Intel64 Family 6 Model 94 Stepping 3, GenuineIntel Aggregate w multiple keys: Best/Avg Time(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------ fasthash = default 5612 / 5882 3.7 267.6 1.0X fasthash = config 3586 / 3595 5.8 171.0 1.6X ``` ## How was this patch tested? the existed test cases. Closes apache#21931 from heary-cao/FastHashCapacity. Authored-by: caoxuewen <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
What changes were proposed in this pull request?
this pr add a configuration parameter to configure the capacity of fast aggregation.
Performance comparison:
How was this patch tested?
the existed test cases.