amogh-jahagirdar commented on code in PR #245: URL: https://github.com/apache/iceberg-python/pull/245#discussion_r1438454375
########## pyiceberg/table/__init__.py: ########## @@ -1904,3 +1913,200 @@ def _generate_snapshot_id() -> int: snapshot_id = snapshot_id if snapshot_id >= 0 else snapshot_id * -1 return snapshot_id + +class UpdateSpec: + _table: Table + _schema: Schema + _spec: PartitionSpec + _name_to_field: Dict[str, PartitionField] + _name_to_added_field: Dict[str, PartitionField] + _transform_to_field: Dict[Tuple[int, str], PartitionField] + _transform_to_added_field: Dict[Tuple[int, str], PartitionField] + _case_sensitive: bool + _adds: List[PartitionField] + _deletes: Set[int] + _last_assigned_partition_id: int + _renames = Dict[str, str] + + def __init__( + self, + table: Table, + transaction: Optional[Transaction] = None, + case_sensitive = True + ) -> None: + self._table = table + self._schema = table.schema() + self._spec = table.spec() + self._name_to_field = {field.name:field for field in self._spec.fields} + self._name_to_added_field = {} + self._transform_to_field = {(field.sourceId, repr(field.transform)): field for field in self._spec.fields} + self._transform_to_added_field = {} + self._adds = [] + self._deletes = {} + self._last_assigned_partition_id = table.spec().last_assigned_field_id + self._renames = {} + self._transaction = transaction + self._case_sensitive = case_sensitive + + + def add_field(self, name: str, transform: Transform) -> UpdateSpec: Review Comment: Few bugs related to name because I was mixing the source name and the actual transform name in the implementation, need to fix that (doesn't matter for identity transforms). -- 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