rdblue commented on code in PR #4679:
URL: https://github.com/apache/iceberg/pull/4679#discussion_r865075618


##########
python/src/iceberg/expressions/base.py:
##########
@@ -328,3 +329,49 @@ def eval(self, struct: StructProtocol) -> Any:
             Any: The value at the referenced field's position in `struct`
         """
         return self._accessor.get(struct)
+
+
+class UnboundReference:
+    """A reference not yet bound to a field in a schema
+
+    Args:
+        name (str): The name of the field
+
+    Note:
+        An unbound reference is sometimes referred to as a "named" reference
+    """
+
+    def __init__(self, name: str):
+        if not name:
+            raise ValueError(f"Name cannot be null: {name}")
+        self._name = name
+
+    def __str__(self) -> str:
+        return f"UnboundReference(name={repr(self.name)})"
+
+    def __repr__(self) -> str:
+        return f"UnboundReference(name={repr(self.name)})"
+
+    @property
+    def name(self) -> str:
+        return self._name
+
+    def bind(self, schema: Schema, case_sensitive: bool) -> BoundReference:
+        """Bind the reference to an Iceberg schema
+
+        Args:
+            schema (Schema): An Iceberg schema
+            case_sensitive (bool): Whether to consider case when binding the 
reference to the field
+
+        Raises:
+            ValueError: If an empty name is provided
+
+        Returns:
+            BoundReference: A reference bound to the specific field in the 
Iceberg schema
+        """
+        field = schema.find_field(name_or_id=self.name, 
case_sensitive=case_sensitive)

Review Comment:
   Yes, they are guaranteed to be unambiguous. Iceberg will fail if there are 
names that map to the same flattened version.



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