oresttokovenko commented on PR #4272:
URL: https://github.com/apache/iceberg-python/pull/4272#issuecomment-6595533691

   @YuangGao What if a table already has data and someone overwrites it with an 
empty table (using the `overwrite()` method in `pyiceberg/table/__init__.py`): 
`files()` comes back empty, but `all_files()` still returns the old data file, 
is that what you'd expect? I added a diagram to help visualize this:
   
   the situation you're merging a fix for
   ```mermaid
      flowchart TD
          A["no snapshot"] --> B["append(0 rows)"]
          B --> C["snapshot with 0 manifests"]
          C --> D["inspect.files() / all_files()"]
          D --> E["results = []<br/>unique_manifests = {}"]
          E --> F{"guard?"}
          F -- "before: none" --> G["ArrowInvalid"]
          F -- "after: not empty" --> H["empty_table(), 0 rows"]
   ```
   
   
   what the new logic can introduce 
      ```mermaid
      flowchart TD
          A["append 3 rows"] --> B["snapshot 1: APPEND<br/>1 manifest, 1 data 
file"]
          B --> C["overwrite with an empty table"]
          C --> D["snapshot 2: DELETE<br/>1 manifest, 0 entries"]
          C --> E["snapshot 3: APPEND<br/>0 manifests"]
          D --> F["current snapshot = 3"]
          E --> F
          F --> G["files(): 0 rows"]
          F --> H["all_files(): manifests from snapshots 1 and 
2<br/>unique_manifests = 2"]
          H -->|"guard on all snapshots"| I["1 row, history kept"]
          H -->|"guard on current snapshot only"| J["0 rows, history 
lost<br/>13 tests pass"]
   ```


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