This is an automated email from the ASF dual-hosted git repository.
yihua pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new d889cc77347 [HUDI-5939] Revert "[HUDI-4675] add unittest for
RebalancedSparkHoodieHBaseIndex (#6458)" (#8197)
d889cc77347 is described below
commit d889cc77347e8c6fe9c96ab7d2c422c4b93addee
Author: Y Ethan Guo <[email protected]>
AuthorDate: Wed Mar 15 22:01:35 2023 -0700
[HUDI-5939] Revert "[HUDI-4675] add unittest for
RebalancedSparkHoodieHBaseIndex (#6458)" (#8197)
This reverts commit c48db6d (#6458), which causes the Azure CI to fail.
---
.../apache/hudi/config/HoodieHBaseIndexConfig.java | 5 --
.../hbase/RebalancedSparkHoodieHBaseIndex.java | 5 +-
.../hbase/TestRebalancedSparkHoodieHBaseIndex.java | 55 ----------------------
3 files changed, 1 insertion(+), 64 deletions(-)
diff --git
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieHBaseIndexConfig.java
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieHBaseIndexConfig.java
index 68db1b1ecc2..359b9ab6a52 100644
---
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieHBaseIndexConfig.java
+++
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieHBaseIndexConfig.java
@@ -501,11 +501,6 @@ public class HoodieHBaseIndexConfig extends HoodieConfig {
return this;
}
- public Builder hbaseRegionBucketNum(String bucketNum) {
- hBaseIndexConfig.setValue(BUCKET_NUMBER, bucketNum);
- return this;
- }
-
/**
* <p>
* Method to set maximum QPS allowed per Region Server. This should be
same across various jobs. This is intended to
diff --git
a/hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/index/hbase/RebalancedSparkHoodieHBaseIndex.java
b/hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/index/hbase/RebalancedSparkHoodieHBaseIndex.java
index 8d68930f1bb..0ee1bef98f8 100644
---
a/hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/index/hbase/RebalancedSparkHoodieHBaseIndex.java
+++
b/hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/index/hbase/RebalancedSparkHoodieHBaseIndex.java
@@ -30,10 +30,7 @@ public class RebalancedSparkHoodieHBaseIndex extends
SparkHoodieHBaseIndex {
}
@Override
- /*
- * @VisibleForTesting
- */
- public String getHBaseKey(String originalKey) {
+ protected String getHBaseKey(String originalKey) {
int bucket = Math.abs(originalKey.hashCode()) %
config.getHBaseIndexRegionCount();
String bucketStr = String.format("%0" +
String.valueOf(config.getHBaseIndexRegionCount() - 1).length() + "d", bucket);
return bucketStr + originalKey;
diff --git
a/hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/index/hbase/TestRebalancedSparkHoodieHBaseIndex.java
b/hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/index/hbase/TestRebalancedSparkHoodieHBaseIndex.java
deleted file mode 100644
index 83e802eb192..00000000000
---
a/hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/index/hbase/TestRebalancedSparkHoodieHBaseIndex.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hudi.index.hbase;
-
-import org.apache.hudi.config.HoodieHBaseIndexConfig;
-import org.apache.hudi.config.HoodieIndexConfig;
-import org.apache.hudi.config.HoodieWriteConfig;
-import org.apache.hudi.index.HoodieIndex;
-
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-public class TestRebalancedSparkHoodieHBaseIndex extends
TestSparkHoodieHBaseIndex {
-
- @Test
- public void testGetHBaseKeyWithPrefix() {
-
- // default bucket count is 8, should add 0-7 prefix to hbase key
- String key = "abc";
- HoodieWriteConfig config =
HoodieWriteConfig.newBuilder().withPath("/foo").build();
- RebalancedSparkHoodieHBaseIndex index = new
RebalancedSparkHoodieHBaseIndex(config);
- assertTrue(index.getHBaseKey(key).matches("[0-7]aaa"));
-
- // if set 100 hbase region count should add 00-99 prefix to hbase key
- config =
HoodieWriteConfig.newBuilder().withPath("/foo").withIndexConfig(HoodieIndexConfig.newBuilder()
- .withIndexType(HoodieIndex.IndexType.HBASE).withHBaseIndexConfig(
-
HoodieHBaseIndexConfig.newBuilder().hbaseRegionBucketNum("100").build()).build()).build();
- index = new RebalancedSparkHoodieHBaseIndex(config);
- assertTrue(index.getHBaseKey(key).matches("\\d{2}aaa"));
-
- // if set 321 hbase region count should add 000-320 prefix to hbase key
- config =
HoodieWriteConfig.newBuilder().withPath("/foo").withIndexConfig(HoodieIndexConfig.newBuilder()
- .withIndexType(HoodieIndex.IndexType.HBASE).withHBaseIndexConfig(
-
HoodieHBaseIndexConfig.newBuilder().hbaseRegionBucketNum("321").build()).build()).build();
- index = new RebalancedSparkHoodieHBaseIndex(config);
- assertTrue(index.getHBaseKey(key).matches("[0-3]\\d{2}aaa"));
- }
-}