zhongyujiang commented on code in PR #5435:
URL: https://github.com/apache/iceberg/pull/5435#discussion_r938720351
##########
parquet/src/main/java/org/apache/iceberg/parquet/Parquet.java:
##########
@@ -231,6 +241,46 @@ private WriteBuilder createContextFunc(
return this;
}
+ private void setBloomFilterConfig(
+ Context context, BiConsumer<String, Boolean> withBloomFilterEnabled) {
+ Splitter dotSplitter = Splitter.on('.');
+ Joiner dotJoiner = Joiner.on(".");
+ context
+ .columnBloomFilterEnabled()
+ .forEach(
+ (columnPath, value) -> {
+ // check the column exists and support bloom filter
+ Types.NestedField field =
schema.caseInsensitiveFindField(columnPath);
+ if (field == null) {
+ LOG.warn(
+ "Invalid bloom filter column configuration, field: {} is
not found in the schema: {}, "
+ + "this column configuration will be ignored.",
+ columnPath,
+ schema);
+ return;
+ }
+ Type fieldType = field.type();
+ // doesn't support boolean, list, map, struct type
+ if (!fieldType.isPrimitiveType()
+ || fieldType.typeId().equals(Type.TypeID.BOOLEAN)) {
+ LOG.warn(
+ "Invalid bloom filter column configuration: field {} is
of type '{}' which cannot "
+ + "benefit from a bloom filter. This column
configuration will be ignored.",
+ columnPath,
+ fieldType);
+ return;
+ }
+
+ String compatibleName =
+ dotJoiner.join(
+ Streams.stream(dotSplitter.split(columnPath))
Review Comment:
Using dot as splitter seems incorrect to me, cause Iceberg allows dots in
field names.
##########
parquet/src/main/java/org/apache/iceberg/parquet/Parquet.java:
##########
@@ -231,6 +241,46 @@ private WriteBuilder createContextFunc(
return this;
}
+ private void setBloomFilterConfig(
+ Context context, BiConsumer<String, Boolean> withBloomFilterEnabled) {
+ Splitter dotSplitter = Splitter.on('.');
+ Joiner dotJoiner = Joiner.on(".");
+ context
+ .columnBloomFilterEnabled()
+ .forEach(
+ (columnPath, value) -> {
+ // check the column exists and support bloom filter
+ Types.NestedField field =
schema.caseInsensitiveFindField(columnPath);
Review Comment:
Maybe we should add this check at the begining, filtering all invalid keys
and making field names compatible before pushing these props down to writer.
What do you think?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]