rdblue commented on code in PR #5435:
URL: https://github.com/apache/iceberg/pull/5435#discussion_r939697691


##########
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))
+                            .map(AvroSchemaUtil::makeCompatibleName)
+                            .collect(Collectors.toList()));

Review Comment:
   This should be separated into a util method in `ParquetSchemaUtil` that can 
be tested.



-- 
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]

Reply via email to