-
Notifications
You must be signed in to change notification settings - Fork 411
feat: Add models for rest scan planning #2861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
kevinjqliu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Agreed with the DataFile serialization problem. We can refactor later on and unify the representation.
For now lets move this forward. Excited to see scan planning in action for pyiceberg 😄
| """Position delete file from REST API.""" | ||
|
|
||
| content: Literal["position-deletes"] = Field(default="position-deletes") | ||
| referenced_data_file: str | None = Field(alias="referenced-data-file", default=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| referenced_data_file: str | None = Field(alias="referenced-data-file", default=None) |
PositionDeleteFile doesnt have this
https://github.com/apache/iceberg/blob/0651b8913d27c3b1c9aca4a9609bec521905fb36/open-api/rest-catalog-open-api.yaml#L4450-L4466
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh yeah it's another gap in the spec. This was for v3 puffin file.
curl -s -X POST http://localhost:8181/v1/namespaces/default/tables/test_positional_mor_deletes_v3/plan \
-H "Content-Type: application/json" \
-d '{"snapshot-id":null,"filter":true,"case-sensitive":true}' | jq
{
"status": "completed",
"plan-id": "sync-e1f10f90-b25e-41f4-a089-dcd66a0a2b33",
"delete-files": [
{
"spec-id": 0,
"content": "position-deletes",
"file-path": "s3://warehouse/default/test_positional_mor_deletes_v3/data/00000-24-214b8ae2-af1b-4caf-88e9-08481c4161d1-00001-deletes.puffin",
"file-format": "puffin",
"partition": [],
"file-size-in-bytes": 467,
"record-count": 1,
"referenced-data-file": "s3://warehouse/default/test_positional_mor_deletes_v3/data/00000-20-309d44b6-a7ee-4309-b629-292375bf84c5-0-00001.parquet",
"content-offset": 4,
"content-size-in-bytes": 42
}
],
"file-scan-tasks": [
{
"data-file": {
"spec-id": 0,
"content": "data",
"file-path": "s3://warehouse/default/test_positional_mor_deletes_v3/data/00000-20-309d44b6-a7ee-4309-b629-292375bf84c5-0-00001.parquet",
"file-format": "parquet",
"partition": [],
"file-size-in-bytes": 1009,
"record-count": 12,
"split-offsets": [
4
],
"sort-order-id": 0,
"first-row-id": 0
},
"delete-file-references": [
0
],
"residual-filter": true
}
]
}
|
|
||
| snapshot_id: int | None = Field(alias="snapshot-id", default=None) | ||
| select: list[str] | None = Field(default=None) | ||
| filter: BooleanExpression | None = Field(default=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| filter: BooleanExpression | None = Field(default=None) | |
| filter: BooleanExpression | None = Field(default=None) | |
| min_rows_requested: int | None = Field(alias="min-rows-requested", default=None) |
missing min_rows_requested https://github.com/apache/iceberg/blob/0651b8913d27c3b1c9aca4a9609bec521905fb36/open-api/rest-catalog-open-api.yaml#L4483-L4507
related to #2775 and #2792
Rationale for this change
This PR adds the Pydantic models for the REST catalog server-side scan planning API focusing on the synchronous use cases first.
There's some redundancy here with things like
RESTDataFilevs the existingDataFilein the manifest module.As mentioned in #2792 the manifest logic with encoding/decoding is dependency on Avro. Rather than trying to solve that unification problem upfront and blocking ourselves, I went with separate REST pydantic types for now. The plan is to eventually add conversion methods or a common interface so these can work together with our existing scan task and content file types.
The models and tests here align with the Java implementation.
Are these changes tested?
Yes, added tests and works against POC
Are there any user-facing changes?
No