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


##########
python/src/iceberg/schema.py:
##########
@@ -471,3 +495,44 @@ def index_name_by_id(schema_or_type) -> Dict[int, str]:
     indexer = _IndexByName()
     visit(schema_or_type, indexer)
     return indexer.by_id()
+
+
+class _BuildPositionAccessors(SchemaVisitor[Dict[int, "Accessor"]]):
+    """A schema visitor for generating a field ID to accessor index"""
+
+    def __init__(self) -> None:
+        self._index: Dict[int, "Accessor"] = {}
+
+    def schema(self, schema, result: Dict[int, "Accessor"]) -> Dict[int, 
"Accessor"]:

Review Comment:
   Nice! We already have that import at the top of this file. I was getting 
`NameError: name 'Accessor' is not defined` but after your comment and playing 
with this a bit I realize it was only 
[this](https://github.com/apache/iceberg/pull/4678/files#diff-03d2c14d19e23634780ee3ccba4a37a5b5a06b0acd1d7c6a5e2a9f7c60da0c1bR500)
 single line that was causing it:
   ```py
   class _BuildPositionAccessors(SchemaVisitor[Dict[int, "Accessor"]]):
   ```
   I wonder if it's because that's a type for a generic? I just left that one 
there and changed `"Accessor"` to `Accessor` everywhere else, thanks @Fokko !



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