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 2019/10/29 15:09:09 UTC
[GitHub] [incubator-iceberg] andrei-ionescu commented on a change in pull
request #585: Fix Iceberg Reader for nested partitions (#575)
andrei-ionescu commented on a change in pull request #585: Fix Iceberg Reader for nested partitions (#575)
URL: https://github.com/apache/incubator-iceberg/pull/585#discussion_r340136523
##########
File path: core/src/main/java/org/apache/iceberg/avro/BuildAvroProjection.java
##########
@@ -81,13 +81,14 @@ public Schema record(Schema record, List<String> names, Iterable<Schema.Field> s
List<Types.NestedField> expectedFields = struct.fields();
for (int i = 0; i < expectedFields.size(); i += 1) {
Types.NestedField field = expectedFields.get(i);
+ String sanitizedFieldName = AvroSchemaUtil.sanitize(field.name());
Review comment:
I tried your suggestion by getting the original name of the `field` by using `field.getProp(AvroSchemaUtil.ICEBERG_FIELD_NAME_PROP)` — the `expectedField` doesn't have it. Method `getProp` return null if the field has not been sanitized as the `ICEBERG_FIELD_NAME_PROP` is not set. This leads to more checks in all conditions bellow.
First, I guess we will still have to check if the `name`s are different for the cases where no sanitization is applied.
Second, we will have to check if the `ICEBERG_FIELD_NAME_PROP` is null itself.
Now, if the `AvroSchemaUtil.sanitize` is a pure function and the sanitization cases are correctly defined and desired to be applied everywhere a field is `!validAvroName`, there should not be any issues using it in other parts over original fields — the output should be the same.
What do you think? Should I change this even though the code will be less readable due to checks?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org