rdblue commented on code in PR #40: URL: https://github.com/apache/iceberg-python/pull/40#discussion_r1349766913
########## pyiceberg/manifest.py: ########## @@ -603,10 +691,26 @@ def __exit__( def content(self) -> ManifestContent: ... + @property @abstractmethod - def new_writer(self) -> AvroOutputFile[ManifestEntry]: + def version(self) -> Literal[1, 2]: ... + def _with_partition(self, format_version: Literal[1, 2]) -> Schema: + data_file_type = data_file_with_partition( + format_version=format_version, partition_type=self._spec.partition_type(self._schema) + ) + return manifest_entry_schema_with_data_file(format_version=format_version, data_file=data_file_type) + + def new_writer(self) -> AvroOutputFile[ManifestEntry]: + return AvroOutputFile[ManifestEntry]( + output_file=self._output_file, + file_schema=self._with_partition(self.version), + schema=self._with_partition(DEFAULT_READ_VERSION) if self.version != DEFAULT_READ_VERSION else None, Review Comment: Could you just check equality in `resolve_writer` instead of the logic here to pass in either 2 or None? I find this a little hard to follow, since it's basically checking whether `self.version == 2` -- 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-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org