jqin61 commented on code in PR #555: URL: https://github.com/apache/iceberg-python/pull/555#discussion_r1544752616
########## pyiceberg/table/__init__.py: ########## @@ -2489,16 +2488,28 @@ def _add_and_move_fields( class WriteTask: write_uuid: uuid.UUID task_id: int + schema: Schema record_batches: List[pa.RecordBatch] sort_order_id: Optional[int] = None + partition_key: Optional[PartitionKey] = None - # Later to be extended with partition information + def generate_data_file_partition_path(self) -> str: + if self.partition_key is None: + raise ValueError("Cannot generate partition path based on non-partitioned WriteTask") + return self.partition_key.to_path() def generate_data_file_filename(self, extension: str) -> str: # Mimics the behavior in the Java API: # https://github.com/apache/iceberg/blob/a582968975dd30ff4917fbbe999f1be903efac02/core/src/main/java/org/apache/iceberg/io/OutputFileFactory.java#L92-L101 return f"00000-{self.task_id}-{self.write_uuid}.{extension}" + def generate_data_file_path(self, extension: str) -> str: + if self.partition_key: + file_path = f"{self.generate_data_file_partition_path()}/{self. generate_data_file_filename(extension)}" Review Comment: resolved in the incoming commit -- 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