Fokko commented on code in PR #4524:
URL: https://github.com/apache/iceberg-python/pull/4524#discussion_r4738461234


##########
mkdocs/docs/api.md:
##########
@@ -2341,6 +2341,28 @@ DataFrame()
 +---+---+
 ```
 
+## Incremental append scan
+
+`incremental_append_scan()` reads only the rows appended to a table between 
two snapshots:
+
+```python
+tbl.incremental_append_scan(
+    from_snapshot_id_exclusive=from_snapshot_id,
+    to_snapshot_id_inclusive=to_snapshot_id,
+).to_arrow()
+```
+
+Both bounds are optional. Without a start, the scan reads from the beginning 
of the table's history, and without an end, up to the current snapshot. The 
start must be an earlier snapshot in the end snapshot's history, or a 
`ValueError` is raised.

Review Comment:
   A few things about this paragraph:
   
   - Without a start, the scan begins at the oldest ancestor of the *end* 
snapshot that hasn't been expired, not at the start of the table's whole 
history. These differ after expiry or a rollback, or when 
`to_snapshot_id_inclusive` isn't the current snapshot. Maybe "from the end 
snapshot's oldest ancestor"?
   - The common polling pattern is to save the last snapshot you read and pass 
it back as `from_snapshot_id_exclusive`. If nothing has been committed since, 
that start equals the current snapshot, and the scan raises:
     ```
     ValueError: Starting snapshot (exclusive) … is not a parent ancestor of 
end snapshot …
     ```
     "Earlier snapshot" technically covers this, but a note telling readers to 
compare against `tbl.current_snapshot()` first would save them a surprise.
   - On the other hand, the exclusive start doesn't need to exist in the 
metadata anymore. An expired snapshot works as long as it's the parent of a 
snapshot that's still there, which is worth mentioning for consumers resuming 
from a saved snapshot ID.



##########
mkdocs/docs/api.md:
##########
@@ -2341,6 +2341,28 @@ DataFrame()
 +---+---+
 ```
 
+## Incremental append scan
+
+`incremental_append_scan()` reads only the rows appended to a table between 
two snapshots:
+
+```python
+tbl.incremental_append_scan(
+    from_snapshot_id_exclusive=from_snapshot_id,
+    to_snapshot_id_inclusive=to_snapshot_id,
+).to_arrow()
+```
+
+Both bounds are optional. Without a start, the scan reads from the beginning 
of the table's history, and without an end, up to the current snapshot. The 
start must be an earlier snapshot in the end snapshot's history, or a 
`ValueError` is raised.
+
+It takes the same filtering and projection arguments, and has the same output 
methods, as [`scan()`](#query-the-data).

Review Comment:
   This isn't quite the same as `scan()`:
   
   - `count()` lives on `DataScan`, so `IncrementalAppendScan` doesn't have it.
   - The "Query the data" section describes REST server-side scan planning 
(`scan-planning-mode=server`). The incremental scan always plans on the client, 
even when the catalog or table asks for server-side planning.
   
   Could we narrow the sentence to the methods it supports (`to_arrow`, 
`to_arrow_batch_reader`, `to_pandas`, `to_duckdb`, `to_ray`, `to_polars`) and 
mention that it's always planned on the client? Adding server-side planning 
support could be a follow-up, since the REST plan request already accepts a 
start and end snapshot.



##########
mkdocs/docs/api.md:
##########
@@ -2341,6 +2341,28 @@ DataFrame()
 +---+---+
 ```
 
+## Incremental append scan
+
+`incremental_append_scan()` reads only the rows appended to a table between 
two snapshots:
+
+```python
+tbl.incremental_append_scan(
+    from_snapshot_id_exclusive=from_snapshot_id,
+    to_snapshot_id_inclusive=to_snapshot_id,
+).to_arrow()
+```

Review Comment:
   Nit: it might be worth mentioning the builder methods too, especially 
`from_snapshot_id_inclusive()`, since the keyword arguments only offer an 
exclusive start:
   ```python
   
tbl.incremental_append_scan().from_snapshot_id_inclusive(snapshot_id).to_arrow()
   ```



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