syun64 commented on PR #821:
URL: https://github.com/apache/iceberg-python/pull/821#issuecomment-2176031538

   > Hi @syun64, this is the stacktrace
   > 
   > ```
   > Traceback (most recent call last):
   >   File "/Users/magus/Workspace/oss/iceberg-python/test_view.py", line 18, 
in <module>
   >     print(list(ancestors_of(t.current_snapshot(), t.metadata)))
   >   File 
"/Users/magus/Workspace/oss/iceberg-python/pyiceberg/table/snapshots.py", line 
428, in ancestors_of
   >     yield from ancestors_of(parent, table_metadata)
   >   File 
"/Users/magus/Workspace/oss/iceberg-python/pyiceberg/table/snapshots.py", line 
428, in ancestors_of
   >     yield from ancestors_of(parent, table_metadata)
   >   File 
"/Users/magus/Workspace/oss/iceberg-python/pyiceberg/table/snapshots.py", line 
428, in ancestors_of
   >     yield from ancestors_of(parent, table_metadata)
   >   [Previous line repeated 992 more times]
   >   File 
"/Users/magus/Workspace/oss/iceberg-python/pyiceberg/table/snapshots.py", line 
427, in ancestors_of
   >     if parent := 
table_metadata.snapshot_by_id(current_snapshot.parent_snapshot_id):
   >   File 
"/Users/magus/Workspace/oss/iceberg-python/pyiceberg/table/metadata.py", line 
231, in snapshot_by_id
   >     return next((snapshot for snapshot in self.snapshots if 
snapshot.snapshot_id == snapshot_id), None)
   >   File 
"/Users/magus/Workspace/oss/iceberg-python/pyiceberg/table/metadata.py", line 
231, in <genexpr>
   >     return next((snapshot for snapshot in self.snapshots if 
snapshot.snapshot_id == snapshot_id), None)
   > RecursionError: maximum recursion depth exceeded in comparison
   > ```
   
   Hey @ndrluis  thanks for sharing the stacktrace. If the issue is with the 
recursion depth, could we try writing this in a way that doesn't require 
recursion?
   
   i.e.
   
   ```
   snapshot = current_snapshot
   while snapshot is not None:
       yield snapshot
       snapshot = 
table_metadata.snapshot_by_id(current_snapshot.parent_snapshot_id)
   ```


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

Reply via email to