samredai commented on code in PR #4609:
URL: https://github.com/apache/iceberg/pull/4609#discussion_r855662810


##########
python/src/iceberg/expressions/base.py:
##########
@@ -122,3 +124,37 @@ def __le__(self, other):
 
     def __ge__(self, other):
         return self.value >= other.value
+
+
+class Accessor(Generic[T], ABC):
+    """An accessor for a specific position in a container of type T

Review Comment:
   Changed `Accessor` to a concrete class. 👍 



##########
python/src/iceberg/expressions/base.py:
##########
@@ -122,3 +124,37 @@ def __le__(self, other):
 
     def __ge__(self, other):
         return self.value >= other.value
+
+
+class Accessor(Generic[T], ABC):
+    """An accessor for a specific position in a container of type T
+
+    Args:
+        Generic[T]: The type of container that can be accessed using this 
Accessor (The container must implement the StructProtocol)
+    """
+
+    def __init__(self, position: int, iceberg_type: IcebergType):
+        self._position = position
+        self._iceberg_type = iceberg_type
+
+    @property
+    def position(self):
+        """The position in the container to access"""
+        return self._position
+
+    @property
+    def iceberg_type(self):
+        """The IcebergType of the value at the accessor position"""
+        return self._value_type
+
+    @abstractmethod
+    def get(self, container: T) -> Any:
+        """Returns the value at self.position in a container of type T
+
+        Args:
+            container(T): A container to access at position `self.position`
+
+        Returns:
+            Any: The value at position `self.position` in the container
+        """
+        ...

Review Comment:
   Fixed!



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to