You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "KnightChess (via GitHub)" <gi...@apache.org> on 2024/07/10 12:18:05 UTC
[PR] [HUDI-7977] import bucket index partitioner [hudi]
KnightChess opened a new pull request, #11608:
URL: https://github.com/apache/hudi/pull/11608
### Change Logs
as https://github.com/apache/hudi/pull/11578 describe, current algorithm in some case has drawbacks, but this new algorithm also has drawbacks, so we can proceed based on practical considerations desgin the ut.
old algorithm:
<img width="952" alt="image" src="https://github.com/apache/hudi/assets/20125927/101cfedf-3a63-4f28-be20-9572adc8f5a7">
new algorithm:

both of them perform bad case https://github.com/apache/hudi/pull/11578#issuecomment-2219339643 : partition values are discontinuous
parallelism = 10, bucketNumber = 5 and partition = ["2021-01-01", "2021-01-03"]
old: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
new: [2, 2, 2, 2, 2]
parallelism = 20, bucketNumber = 5 and partition = ["2021-01-01", "2021-01-03"]
old: [2, 2, 2, 2, 2]
new: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
### Impact
none
### Risk level (write none, low medium or high below)
low
### Documentation Update
none
### Contributor's checklist
- [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
- [ ] Change Logs and Impact were stated clearly
- [ ] Adequate tests were added if applicable
- [ ] CI passed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7977] import bucket index partitioner [hudi]
Posted by "KnightChess (via GitHub)" <gi...@apache.org>.
KnightChess commented on PR #11608:
URL: https://github.com/apache/hudi/pull/11608#issuecomment-2220529640
@danny0405 @xicm cc:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7977] import bucket index partitioner [hudi]
Posted by "KnightChess (via GitHub)" <gi...@apache.org>.
KnightChess closed pull request #11608: [HUDI-7977] import bucket index partitioner
URL: https://github.com/apache/hudi/pull/11608
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7977] Improve bucket index partitioner algorithm [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on PR #11608:
URL: https://github.com/apache/hudi/pull/11608#issuecomment-2242401629
@stream2000 Should not, it only impacts the task rebalance of writers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7977] Improve bucket index partitioner algorithm [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 merged PR #11608:
URL: https://github.com/apache/hudi/pull/11608
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7977] import bucket index partitioner [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11608:
URL: https://github.com/apache/hudi/pull/11608#issuecomment-2220692616
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "3175c04ed10009da40aa6cb9d8e2b4432678d38f",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24806",
"triggerID" : "3175c04ed10009da40aa6cb9d8e2b4432678d38f",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 3175c04ed10009da40aa6cb9d8e2b4432678d38f Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24806)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7977] Improve bucket index partitioner algorithm [hudi]
Posted by "stream2000 (via GitHub)" <gi...@apache.org>.
stream2000 commented on PR #11608:
URL: https://github.com/apache/hudi/pull/11608#issuecomment-2242383914
Hi, @KnightChess , @danny0405 will changing the algorithm impact backward compatibility with existing data?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7977] Improve bucket index partitioner algorithm [hudi]
Posted by "KnightChess (via GitHub)" <gi...@apache.org>.
KnightChess commented on PR #11608:
URL: https://github.com/apache/hudi/pull/11608#issuecomment-2242501957
@stream2000 yes, as @danny0405 say.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7977] import bucket index partitioner [hudi]
Posted by "CTTY (via GitHub)" <gi...@apache.org>.
CTTY commented on code in PR #11608:
URL: https://github.com/apache/hudi/pull/11608#discussion_r1673121749
##########
hudi-common/src/main/java/org/apache/hudi/common/util/hash/BucketIndexUtil.java:
##########
@@ -36,26 +36,10 @@ public class BucketIndexUtil {
* @return The partition index of this bucket.
*/
public static Functions.Function2<String, Integer, Integer> getPartitionIndexFunc(int bucketNum, int parallelism) {
- if (parallelism < bucketNum) {
- return (partition, curBucket) -> {
- int partitionIndex = (partition.hashCode() & Integer.MAX_VALUE) / parallelism * bucketNum;
- int globalIndex = partitionIndex + curBucket;
- return globalIndex % parallelism;
- };
- } else {
- if (parallelism % bucketNum == 0) {
- return (partition, curBucket) -> {
- int partitionIndex = (partition.hashCode() & Integer.MAX_VALUE) / (parallelism / bucketNum) * bucketNum;
- int globalIndex = partitionIndex + curBucket;
- return globalIndex % parallelism;
- };
- } else {
- return (partition, curBucket) -> {
- int partitionIndex = (partition.hashCode() & Integer.MAX_VALUE) / (parallelism / bucketNum + 1) * bucketNum;
- int globalIndex = partitionIndex + curBucket;
- return globalIndex % parallelism;
- };
- }
- }
+ return (partition, curBucket) -> {
+ int partitionIndex = (partition.hashCode() & Integer.MAX_VALUE) % parallelism * bucketNum;
+ int globalIndex = partitionIndex + curBucket;
+ return globalIndex % parallelism;
+ };
Review Comment:
nit: Can we update the comment to reflect the logic of this new algorithm
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7977] import bucket index partitioner [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11608:
URL: https://github.com/apache/hudi/pull/11608#issuecomment-2220434167
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "3175c04ed10009da40aa6cb9d8e2b4432678d38f",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24806",
"triggerID" : "3175c04ed10009da40aa6cb9d8e2b4432678d38f",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 3175c04ed10009da40aa6cb9d8e2b4432678d38f Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24806)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7977] import bucket index partitioner [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11608:
URL: https://github.com/apache/hudi/pull/11608#issuecomment-2220417516
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "3175c04ed10009da40aa6cb9d8e2b4432678d38f",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "3175c04ed10009da40aa6cb9d8e2b4432678d38f",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 3175c04ed10009da40aa6cb9d8e2b4432678d38f UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org