zhangyue19921010 commented on code in PR #13365:
URL: https://github.com/apache/hudi/pull/13365#discussion_r2124133565
##########
hudi-common/src/main/java/org/apache/hudi/common/bloom/HoodieDynamicBoundedBloomFilter.java:
##########
@@ -125,5 +126,42 @@ private void
extractAndSetInternalBloomFilter(DataInputStream dis) throws IOExce
internalDynamicBloomFilter = new InternalDynamicBloomFilter();
internalDynamicBloomFilter.readFields(dis);
}
+
+ @Override
+ public void or(BloomFilter other) {
+ if (other != null) {
+ ValidationUtils.checkArgument(other instanceof
HoodieDynamicBoundedBloomFilter,
+ "HoodieDynamicBoundedBloomFilter can only perform OR operations with
other HoodieDynamicBoundedBloomFilter.");
+ HoodieDynamicBoundedBloomFilter otherFilter =
(HoodieDynamicBoundedBloomFilter) other;
+ int sourceMatrixLength = this.getMatrixLength();
+ int targetMatrixLength = otherFilter.getMatrixLength();
+ if (targetMatrixLength > sourceMatrixLength) {
+ this.rescaleFromTarget(targetMatrixLength);
+ } else {
+ otherFilter.rescaleFromTarget(sourceMatrixLength);
+ }
+
this.internalDynamicBloomFilter.or(otherFilter.internalDynamicBloomFilter);
+ }
+ }
+
+ /**
+ * rescale the internal dynamic bloom filter by length
+ * @param targetMatrixLength
+ * @return
+ */
+ private HoodieDynamicBoundedBloomFilter rescaleFromTarget(int
targetMatrixLength) {
+ int initMatrixLength = this.internalDynamicBloomFilter.getMatrixLength();
+ int needAddRowNum = targetMatrixLength - initMatrixLength;
+ if (needAddRowNum > 0) {
+ for (int i = 0; i < needAddRowNum; i++) {
+ this.internalDynamicBloomFilter.addRow();
Review Comment:
Nice catch here. add a new func addRows to improve performance.
##########
hudi-common/src/main/java/org/apache/hudi/common/config/TypedProperties.java:
##########
@@ -39,7 +39,7 @@ public TypedProperties() {
super(null);
}
- protected TypedProperties(Properties defaults) {
+ public TypedProperties(Properties defaults) {
Review Comment:
removed.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]