You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "syun64 (via GitHub)" <gi...@apache.org> on 2024/03/09 22:52:19 UTC

[PR] [Bug Fix] Allow Partition data to be nullable in ManifestEntry [iceberg-python]

syun64 opened a new pull request, #509:
URL: https://github.com/apache/iceberg-python/pull/509

   Similar to how the [partition fields are already initialized](https://github.com/apache/iceberg-python/blob/pyiceberg-0.6.x/pyiceberg/partitioning.py#L193) with `required=False` in `partition_type`, we should set `required=False` in the manifest_entry schema within the ManifestFile.
   
   This PR introduces this fix first from @jqin61 's WIP PR, so other PRs that add partition values to manifest files can be unblocked.
   
   Without this change, we cannot serialize None partition values into the ManifestEntry in the avro file.
   
   Below WIP PRs require this change
   Partitioned Write: https://github.com/apache/iceberg-python/pull/353
   Add Files: https://github.com/apache/iceberg-python/pull/506
   
   


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


Re: [PR] [Bug Fix] Allow Partition data to be nullable in ManifestEntry [iceberg-python]

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on code in PR #509:
URL: https://github.com/apache/iceberg-python/pull/509#discussion_r1518833699


##########
pyiceberg/manifest.py:
##########
@@ -308,6 +308,7 @@ def data_file_with_partition(partition_type: StructType, format_version: Literal
             field_id=field.field_id,
             name=field.name,
             field_type=partition_field_to_data_file_partition_field(field.field_type),
+            required=False,

Review Comment:
   What do you think of carrying this over from the field?
   
   ```suggestion
               required=field.required,
   ```
   
   I would prefer this because Avro schema's are translated to Iceberg, and then used in reading the files. In Avro reading an optional field is different than reading a required field (in the case of an optional field, it will first read a boolean checking if the value is there).



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


Re: [PR] [Bug Fix] Allow Partition data to be nullable in ManifestEntry [iceberg-python]

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on code in PR #509:
URL: https://github.com/apache/iceberg-python/pull/509#discussion_r1518833699


##########
pyiceberg/manifest.py:
##########
@@ -308,6 +308,7 @@ def data_file_with_partition(partition_type: StructType, format_version: Literal
             field_id=field.field_id,
             name=field.name,
             field_type=partition_field_to_data_file_partition_field(field.field_type),
+            required=False,

Review Comment:
   What do you think of carrying this over from the field?
   
   ```suggestion
               required=field.required,
   ```
   
   I would prefer this because Avro schema's are translated to Iceberg, and then used in reading the files. In Avro reading an optional field is different than reading a required field (in the case of an optional field, it will first read a boolean checking if the value is there).
   
   I checked locally in tests, and there the fields are not required.



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


Re: [PR] [Bug Fix] Allow Partition data to be nullable in ManifestEntry [iceberg-python]

Posted by "syun64 (via GitHub)" <gi...@apache.org>.
syun64 commented on code in PR #509:
URL: https://github.com/apache/iceberg-python/pull/509#discussion_r1518883984


##########
pyiceberg/manifest.py:
##########
@@ -308,6 +308,7 @@ def data_file_with_partition(partition_type: StructType, format_version: Literal
             field_id=field.field_id,
             name=field.name,
             field_type=partition_field_to_data_file_partition_field(field.field_type),
+            required=False,

Review Comment:
   Sounds good @Fokko . I've made the corresponding change to partition_type to carry this over from the partition field as suggested 👍



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


Re: [PR] [Bug Fix] Allow Partition data to be nullable in ManifestEntry [iceberg-python]

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko merged PR #509:
URL: https://github.com/apache/iceberg-python/pull/509


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