You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "yihua (via GitHub)" <gi...@apache.org> on 2026/07/07 19:38:57 UTC
[PR] test(client): cover low-coverage small classes across hudi-client [hudi]
yihua opened a new pull request, #19224:
URL: https://github.com/apache/hudi/pull/19224
### Describe the issue this Pull Request addresses
Several small, self-contained classes in the `hudi-client` modules (client-common, spark-client, java-client) have little or no direct unit-test coverage: simple enums, exception types, value/POJO holders, config-driven factories, and small utilities. This PR adds focused, cheap unit tests for a batch of these classes so their behavior is pinned and regressions (renames, reordered enum constants, broken selection branches) are caught early.
### Summary and Changelog
Adds 12 new test classes covering 15 small classes across the three JVM-side client modules. No production code is changed. Each test asserts real behavior rather than bare instantiation.
hudi-client-common:
- `TestLockResultEnums` covers `LockGetResult` and `LockUpsertResult`: pins each constant's numeric `getCode()` and the full value set, and verifies `valueOf` round-trips.
- `TestAuditOperationState` covers `AuditOperationState`: asserts the declared states and their order, `valueOf` resolution, and rejection of an unknown state.
- `TestClientExceptions` covers `HoodieKeyGeneratorException`, `HoodieCompactionException`, and `HoodieRollbackException`: message/cause preservation for both constructor arms and the `HoodieException` type hierarchy.
- `TestBucketTypeAndInfo` covers `BucketType` and `BucketInfo`: enum values/`valueOf`, getter values, `equals`/`hashCode` across all fields, and `toString` content.
- `TestBloomIndexFileInfo` covers `BloomIndexFileInfo`: both constructors, `hasKeyRanges`, inclusive `isKeyInRange` bounds (and the null-bound guard), and value equality.
- `TestClientStatsPojos` covers `SecondaryIndexStats` and `TableWriteStats`: constructor values, setters, equality, the single-arg constructor defaulting metadata stats to empty, and the `isEmptyDataTableWriteStats` branch.
- `TestBootstrapPartitionPathTranslators` covers `IdentityBootstrapPartitionPathTranslator` and `DecodedBootstrapPartitionPathTranslator`: identity pass-through vs URI-decoding of an escaped path.
- `TestOperationConverter` covers `OperationConverter`: valid enum-name conversion and the unknown-value rejection branch.
- `TestBulkInsertSortMode` covers `BulkInsertSortMode`: pins the full ordered constant set (the names double as config values) and case-sensitive `valueOf`.
hudi-java-client:
- `TestJavaBulkInsertInternalPartitionerFactory` covers `JavaBulkInsertInternalPartitionerFactory`: both supported sort-mode branches select the expected partitioner, and unsupported modes throw.
hudi-spark-client:
- `TestSparkBucketInfoGetter` covers `ListBasedSparkBucketInfoGetter` and `MapBasedSparkBucketInfoGetter`: positional list lookup (including out-of-range), map lookup by bucket number, and the missing-key null result.
- `TestHoodieBloomFilterProbingResult` covers `HoodieBloomFilterProbingResult`: candidate-key accessor, empty set, and value equality.
No code was copied.
### Impact
Test-only change. No public API, user-facing behavior, or performance impact.
### Risk Level
low
Tests only; no production code is touched. They exercise existing public behavior with deterministic in-memory inputs and no I/O.
### Documentation Update
none
### Contributor's checklist
- [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
- [ ] Enough context is provided in the sections above
- [ ] Adequate tests were added if applicable
--
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] test(client): cover low-coverage small classes across hudi-client [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #19224:
URL: https://github.com/apache/hudi/pull/19224#issuecomment-4908009699
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "c4b02355a3b8018026cc158463aa2bbc5831f986",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "c4b02355a3b8018026cc158463aa2bbc5831f986",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* c4b02355a3b8018026cc158463aa2bbc5831f986 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
Re: [PR] test(client): cover low-coverage small classes across hudi-client [hudi]
Posted by "voonhous (via GitHub)" <gi...@apache.org>.
voonhous commented on code in PR #19224:
URL: https://github.com/apache/hudi/pull/19224#discussion_r3543410143
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/index/bloom/TestBloomIndexFileInfo.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.bloom;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Tests {@link BloomIndexFileInfo} accessors and key-range checks.
+ */
+public class TestBloomIndexFileInfo {
+
+ @Test
+ void fileIdOnlyConstructorLeavesRangeUnset() {
+ BloomIndexFileInfo info = new BloomIndexFileInfo("f1");
+ assertEquals("f1", info.getFileId());
+ assertNull(info.getMinRecordKey());
+ assertNull(info.getMaxRecordKey());
+ assertFalse(info.hasKeyRanges());
+ }
+
+ @Test
+ void fullConstructorPopulatesRange() {
+ BloomIndexFileInfo info = new BloomIndexFileInfo("f1", "key05", "key20");
+ assertEquals("key05", info.getMinRecordKey());
+ assertEquals("key20", info.getMaxRecordKey());
+ assertTrue(info.hasKeyRanges());
+ }
+
+ @Test
+ void isKeyInRangeIsInclusiveOfBounds() {
+ BloomIndexFileInfo info = new BloomIndexFileInfo("f1", "key05", "key20");
+ assertTrue(info.isKeyInRange("key05"));
+ assertTrue(info.isKeyInRange("key10"));
+ assertTrue(info.isKeyInRange("key20"));
+ assertFalse(info.isKeyInRange("key04"));
+ assertFalse(info.isKeyInRange("key21"));
+ }
+
+ @Test
+ void isKeyInRangeRequiresBounds() {
+ BloomIndexFileInfo noRange = new BloomIndexFileInfo("f1");
+ assertThrows(NullPointerException.class, () -> noRange.isKeyInRange("key10"));
Review Comment:
Nit: this pins the bare `NullPointerException` from `Objects.requireNonNull(minRecordKey)` as the contract for calling `isKeyInRange` on a no-range info. Fine as a characterization test, but a later change that makes the missing-bounds case return `false` or throw a clearer exception would trip this and read like a regression. A one-line comment noting the NPE is the current (ungraceful) behavior would make the intent explicit.
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/index/bloom/TestBloomIndexFileInfo.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.bloom;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Tests {@link BloomIndexFileInfo} accessors and key-range checks.
+ */
+public class TestBloomIndexFileInfo {
+
+ @Test
+ void fileIdOnlyConstructorLeavesRangeUnset() {
+ BloomIndexFileInfo info = new BloomIndexFileInfo("f1");
+ assertEquals("f1", info.getFileId());
+ assertNull(info.getMinRecordKey());
+ assertNull(info.getMaxRecordKey());
+ assertFalse(info.hasKeyRanges());
+ }
+
+ @Test
+ void fullConstructorPopulatesRange() {
+ BloomIndexFileInfo info = new BloomIndexFileInfo("f1", "key05", "key20");
+ assertEquals("key05", info.getMinRecordKey());
+ assertEquals("key20", info.getMaxRecordKey());
+ assertTrue(info.hasKeyRanges());
+ }
+
+ @Test
+ void isKeyInRangeIsInclusiveOfBounds() {
+ BloomIndexFileInfo info = new BloomIndexFileInfo("f1", "key05", "key20");
+ assertTrue(info.isKeyInRange("key05"));
+ assertTrue(info.isKeyInRange("key10"));
+ assertTrue(info.isKeyInRange("key20"));
+ assertFalse(info.isKeyInRange("key04"));
+ assertFalse(info.isKeyInRange("key21"));
+ }
+
+ @Test
+ void isKeyInRangeRequiresBounds() {
+ BloomIndexFileInfo noRange = new BloomIndexFileInfo("f1");
+ assertThrows(NullPointerException.class, () -> noRange.isKeyInRange("key10"));
+ }
+
+ @Test
+ void valueSemanticsForEqualsAndHashCode() {
+ BloomIndexFileInfo a = new BloomIndexFileInfo("f1", "min", "max");
+ BloomIndexFileInfo same = new BloomIndexFileInfo("f1", "min", "max");
+ BloomIndexFileInfo different = new BloomIndexFileInfo("f2", "min", "max");
+ assertEquals(a, same);
+ assertEquals(a.hashCode(), same.hashCode());
+ assertFalse(a.equals(different));
Review Comment:
Nit: `assertFalse(a.equals(different))` -- the sibling equality assertions (and `TestBucketTypeAndInfo`) use `assertNotEquals(a, different)`. Minor consistency.
--
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] test(client): cover low-coverage small classes across hudi-client [hudi]
Posted by "voonhous (via GitHub)" <gi...@apache.org>.
voonhous commented on code in PR #19224:
URL: https://github.com/apache/hudi/pull/19224#discussion_r3543409117
##########
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/index/bloom/TestHoodieBloomFilterProbingResult.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.bloom;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Tests the {@link HoodieBloomFilterProbingResult} value holder.
+ */
+public class TestHoodieBloomFilterProbingResult {
+
+ @Test
+ void exposesCandidateKeys() {
+ Set<String> keys = new HashSet<>();
+ keys.add("k1");
+ keys.add("k2");
+ HoodieBloomFilterProbingResult result = new HoodieBloomFilterProbingResult(keys);
+ assertSame(keys, result.getCandidateKeys());
Review Comment:
Nit: `assertSame` pins that the getter hands back the caller's `Set` by reference, which is a Lombok `@Value` implementation detail rather than a behavioral contract. If a defensive copy is ever added the accessor is still correct but this test breaks. `assertEquals(keys, result.getCandidateKeys())` captures the property that actually matters. Same pattern in `TestClientStatsPojos` L76 (`assertSame(dataStats, stats.getDataTableWriteStats())`).
--
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] test(client): cover low-coverage small classes across hudi-client [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #19224:
URL: https://github.com/apache/hudi/pull/19224#issuecomment-4908055534
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "c4b02355a3b8018026cc158463aa2bbc5831f986",
"status" : "PENDING",
"url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=15375",
"triggerID" : "c4b02355a3b8018026cc158463aa2bbc5831f986",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* c4b02355a3b8018026cc158463aa2bbc5831f986 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=15375)
<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] test(client): cover low-coverage small classes across hudi-client [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #19224:
URL: https://github.com/apache/hudi/pull/19224#issuecomment-4910563024
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "c4b02355a3b8018026cc158463aa2bbc5831f986",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=15375",
"triggerID" : "c4b02355a3b8018026cc158463aa2bbc5831f986",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* c4b02355a3b8018026cc158463aa2bbc5831f986 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=15375)
<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] test(client): cover low-coverage small classes across hudi-client [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #19224:
URL: https://github.com/apache/hudi/pull/19224#issuecomment-4914362133
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "c4b02355a3b8018026cc158463aa2bbc5831f986",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=15375",
"triggerID" : "c4b02355a3b8018026cc158463aa2bbc5831f986",
"triggerType" : "PUSH"
}, {
"hash" : "39cb220c4168ada8cc128c67262f6ebe5b3ab47b",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "39cb220c4168ada8cc128c67262f6ebe5b3ab47b",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* c4b02355a3b8018026cc158463aa2bbc5831f986 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=15375)
* 39cb220c4168ada8cc128c67262f6ebe5b3ab47b 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
Re: [PR] test(client): cover low-coverage small classes across hudi-client [hudi]
Posted by "voonhous (via GitHub)" <gi...@apache.org>.
voonhous commented on code in PR #19224:
URL: https://github.com/apache/hudi/pull/19224#discussion_r3543454471
##########
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/index/bloom/TestHoodieBloomFilterProbingResult.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.bloom;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Tests the {@link HoodieBloomFilterProbingResult} value holder.
+ */
+public class TestHoodieBloomFilterProbingResult {
+
+ @Test
+ void exposesCandidateKeys() {
+ Set<String> keys = new HashSet<>();
+ keys.add("k1");
+ keys.add("k2");
+ HoodieBloomFilterProbingResult result = new HoodieBloomFilterProbingResult(keys);
+ assertSame(keys, result.getCandidateKeys());
Review Comment:
Switched to `assertEquals` on the contents here and in `TestClientStatsPojos`, so neither test pins the no-copy detail anymore.
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/index/bloom/TestBloomIndexFileInfo.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.bloom;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Tests {@link BloomIndexFileInfo} accessors and key-range checks.
+ */
+public class TestBloomIndexFileInfo {
+
+ @Test
+ void fileIdOnlyConstructorLeavesRangeUnset() {
+ BloomIndexFileInfo info = new BloomIndexFileInfo("f1");
+ assertEquals("f1", info.getFileId());
+ assertNull(info.getMinRecordKey());
+ assertNull(info.getMaxRecordKey());
+ assertFalse(info.hasKeyRanges());
+ }
+
+ @Test
+ void fullConstructorPopulatesRange() {
+ BloomIndexFileInfo info = new BloomIndexFileInfo("f1", "key05", "key20");
+ assertEquals("key05", info.getMinRecordKey());
+ assertEquals("key20", info.getMaxRecordKey());
+ assertTrue(info.hasKeyRanges());
+ }
+
+ @Test
+ void isKeyInRangeIsInclusiveOfBounds() {
+ BloomIndexFileInfo info = new BloomIndexFileInfo("f1", "key05", "key20");
+ assertTrue(info.isKeyInRange("key05"));
+ assertTrue(info.isKeyInRange("key10"));
+ assertTrue(info.isKeyInRange("key20"));
+ assertFalse(info.isKeyInRange("key04"));
+ assertFalse(info.isKeyInRange("key21"));
+ }
+
+ @Test
+ void isKeyInRangeRequiresBounds() {
+ BloomIndexFileInfo noRange = new BloomIndexFileInfo("f1");
+ assertThrows(NullPointerException.class, () -> noRange.isKeyInRange("key10"));
Review Comment:
Added a short comment noting the no-bounds case currently fails fast with an NPE from `Objects.requireNonNull` rather than returning false, so a future graceful-failure change is flagged intentionally.
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/index/bloom/TestBloomIndexFileInfo.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.bloom;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Tests {@link BloomIndexFileInfo} accessors and key-range checks.
+ */
+public class TestBloomIndexFileInfo {
+
+ @Test
+ void fileIdOnlyConstructorLeavesRangeUnset() {
+ BloomIndexFileInfo info = new BloomIndexFileInfo("f1");
+ assertEquals("f1", info.getFileId());
+ assertNull(info.getMinRecordKey());
+ assertNull(info.getMaxRecordKey());
+ assertFalse(info.hasKeyRanges());
+ }
+
+ @Test
+ void fullConstructorPopulatesRange() {
+ BloomIndexFileInfo info = new BloomIndexFileInfo("f1", "key05", "key20");
+ assertEquals("key05", info.getMinRecordKey());
+ assertEquals("key20", info.getMaxRecordKey());
+ assertTrue(info.hasKeyRanges());
+ }
+
+ @Test
+ void isKeyInRangeIsInclusiveOfBounds() {
+ BloomIndexFileInfo info = new BloomIndexFileInfo("f1", "key05", "key20");
+ assertTrue(info.isKeyInRange("key05"));
+ assertTrue(info.isKeyInRange("key10"));
+ assertTrue(info.isKeyInRange("key20"));
+ assertFalse(info.isKeyInRange("key04"));
+ assertFalse(info.isKeyInRange("key21"));
+ }
+
+ @Test
+ void isKeyInRangeRequiresBounds() {
+ BloomIndexFileInfo noRange = new BloomIndexFileInfo("f1");
+ assertThrows(NullPointerException.class, () -> noRange.isKeyInRange("key10"));
+ }
+
+ @Test
+ void valueSemanticsForEqualsAndHashCode() {
+ BloomIndexFileInfo a = new BloomIndexFileInfo("f1", "min", "max");
+ BloomIndexFileInfo same = new BloomIndexFileInfo("f1", "min", "max");
+ BloomIndexFileInfo different = new BloomIndexFileInfo("f2", "min", "max");
+ assertEquals(a, same);
+ assertEquals(a.hashCode(), same.hashCode());
+ assertFalse(a.equals(different));
Review Comment:
Switched to `assertNotEquals(a, different)` for consistency with the sibling equality tests.
--
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] test(client): cover low-coverage small classes across hudi-client [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #19224:
URL: https://github.com/apache/hudi/pull/19224#issuecomment-4914403857
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "c4b02355a3b8018026cc158463aa2bbc5831f986",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=15375",
"triggerID" : "c4b02355a3b8018026cc158463aa2bbc5831f986",
"triggerType" : "PUSH"
}, {
"hash" : "39cb220c4168ada8cc128c67262f6ebe5b3ab47b",
"status" : "PENDING",
"url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=15385",
"triggerID" : "39cb220c4168ada8cc128c67262f6ebe5b3ab47b",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* c4b02355a3b8018026cc158463aa2bbc5831f986 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=15375)
* 39cb220c4168ada8cc128c67262f6ebe5b3ab47b Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=15385)
<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] test(client): cover low-coverage small classes across hudi-client [hudi]
Posted by "voonhous (via GitHub)" <gi...@apache.org>.
voonhous merged PR #19224:
URL: https://github.com/apache/hudi/pull/19224
--
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