You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/08/05 11:41:30 UTC
[GitHub] [iceberg] zhongyujiang commented on a diff in pull request #5435: Parquet: Set parquet bloom filter config with compatible column name
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org