Repository navigation
Conversation
| description: Return all directory identifiers under this namespace | ||
| operationId: listDirectories | ||
| parameters: | ||
| - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token' |
There was a problem hiding this comment.
I disagree with how pagination is defined in IRC, specifically:
polaris/spec/iceberg-rest-catalog-open-api.yaml
Lines 2403 to 2405 in 5fafc67
The idea of clients forcing servers into returning all data is against the very premise of pagination.
We are fixing this in our IRC API impl. in #5282 and #5553. I think we should do proper pagination in the Directories API upfront:
- Clients should always expect that a response may be paginated
- Clients do not need to set either the
page-tokenorpage-sizeon the initial request to initiate pagination. The server decides. - The server decides on actual page sizes. The can be smaller than the
page-sizehint. - A server may choose not to support pagination and return all data in one chunk (but Polaris will support pagination, I assume).
Related discussions:
https://lists.apache.org/thread/k81ptyktdbdf8gynncgk3o04mqt85zyk
https://lists.apache.org/thread/mmqllcbt2lfsrq571cfwbymgfwoxqdf0
There was a problem hiding this comment.
+1 on doing proper pagination in the Directories API from the start.
|
|
||
| --- | ||
| paths: | ||
| /polaris/v1/{prefix}/namespaces/{namespace}/directories: |
There was a problem hiding this comment.
Non-blocking: this path prefix interleaves with other Polaris API (e.g. Generic Tables, Policies...). Since endpoints are distinct, it is not a problem. However, it makes separating APIs more difficult.
The v1 prefix is shared and it is usually perceived as the "API root".
There is no static prefix just for the directories API, which can complicate network routing if someone wants to segregate traffic by API.
I know this fit the existing pattern, so my comment is non-blocking 😅
There was a problem hiding this comment.
The intent is to align with other Polaris APIs.
I'm fine to change that but it would be probably a bit confusing for users. A possible alternative would be to hook in Generic Tables but I don't think it's a great idea from a semantic perspective.
There was a problem hiding this comment.
No worries, this is more of an opinion on my part (non-blocking).
|
|
||
| --- | ||
| paths: | ||
| /polaris/v1/{prefix}/namespaces/{namespace}/directories: |
There was a problem hiding this comment.
Do we need a new endpoint for the directory? It is a sub type of generic table. I think we could follow the way we introduce Delta/Hudi/Paimon.
There was a problem hiding this comment.
I think it's semantically different: my take on Generic Table is for non-Iceberg table.
As Inventory is a Iceberg table and Directory is a new "feature", I think it makes more sense to have dedicated endpoint.
There was a problem hiding this comment.
I think a directory table is essentially a type of generic table. They share the same location management requirements, including but not limited to base location, overlap checking, and credential vending.
This makes directory tables quite different from other entities, such as policies and tags, which don't require storage.
I'm not sure we need to reinvent what we've already implemented for generic tables.
There was a problem hiding this comment.
I'm still in favor of different endpoints because:
filterandscan-scheduleare typed. As a generic table, they would become untyped string properties.- There's a
scanaction, which generic tables don't have. - What users query is an Iceberg table (
__inventory), and generic tables are defined as non-Iceberg. base-locationpoints at existing external data the catalog doesn't own.
If the implementation PR (phase 2) can reuse the generic-table code for location validation, overlap checks and credential vending, keeping the API separate doesn't mean rebuilding everything.
Should a directory be allowed over a prefix that overlaps an existing table's location? Generic table rules would reject that, and it's plausible use case.
So, I'm still in favor of Directory endpoint, not generic table.
There was a problem hiding this comment.
I think a separate Directories endpoint makes sense.
- It defines a specific and focused contract.
- It defines functionality beyond the scope of Generic Tables.
- It evolves independently of the Generic Tables API.
- It allows downstream projects to elect implementing Directories with or without the broader Generic Tables.
Use kebab-case base-location, add the /polaris path prefix to the docs, define server-driven pagination, document the inventory name conflict, pin the regex dialect and fix the docs examples.
1dd83f7 to
95bd102
Compare
|
from CI: |
…feature flag - Define a local DirectoryPageToken schema so the Directories API documents its own pagination semantics instead of inheriting the IRC PageToken ones. - Rename the local page-token and page-size parameters to avoid colliding with the IRC components in the bundled spec. - Remove scan-schedule: Polaris does not act on it, and scanning services decide when to re-scan. - Move the ENABLE_DIRECTORIES feature flag to the implementation PR, as it does not gate anything yet. - Regenerate the bundled OpenAPI spec.
flyrain
left a comment
There was a problem hiding this comment.
Thanks a lot for working on it, JB!
…ing and page token - Remove the scan endpoint: the scan execution and inventory ownership model with external scanning services needs to be defined first. - Remove the Polaris-Directory-Access-Delegation header and the storage-access-configs response field, as credential vending for the directory base-location is not supported yet. This also reverts the StorageAccessConfig move to common-schemas.yaml. - Use an inline schema for the pageToken query parameter. - Regenerate the bundled OpenAPI spec.
…e and beta label - Mark each Directories API operation as beta in the spec, as done for the semantic-model API. - Move filter into a new scanner-config object (DirectoryScannerConfig), so more scanner options can be added later without new top-level fields. - Return the optional inventory-table identifier when a directory is loaded, absent if the inventory table does not exist. - Document that the directory table is a snapshot as of the last scan and can lag behind the object store. - Make last_modified required in the directory table schema. - Explain why checksum_algorithm is set per object. - State that credential vending for the base-location objects is planned. - Regenerate the bundled OpenAPI spec.
ArnabKarmakar1108
left a comment
There was a problem hiding this comment.
Thanks for working on this! The docs LGTM! Ive dropped a few comments on the next two PRs and since they are not part of 1.9.0 those can be addressed later.
|
FYI: following the pagination discussion here and on #5943, I opened #6028 (draft). It adds shared pagination definitions for Polaris APIs in |
flyrain
left a comment
There was a problem hiding this comment.
Thanks a lot for working on it, JB! Post some comments.
| - $ref: '#/components/parameters/directory-page-token' | ||
| - $ref: '#/components/parameters/directory-page-size' |
There was a problem hiding this comment.
Not a blocker: I'd suggest to use one common pagination schema cross Polaris end points, if we are not using IRC pagination schema. We now have different pagination schema in different end points. This fragmentation is unnecessary. I'm OK with a followup. Can we file an issue for this.
There was a problem hiding this comment.
Agreed. #6028 adds shared pagination definitions for the Polaris APIs (spec/polaris-pagination.yaml), with the same rules as directory-page-token and DirectoryPageToken here. Once it lands, I will switch the Directories API to the shared definitions in a follow-up.
| **Beta:** The Directories API is under active development and may change in a | ||
| backward-incompatible way. | ||
|
|
||
| Create a directory under the given namespace, and return the created directory information as a response. |
There was a problem hiding this comment.
Do we create the inventory table by default? If not, how do we return the inventory table identifier? If yes, does it involve the first-time scan?
Can clients control the behavior(whether to create the inventory table)? For example, a user may just need a simple managed volume without the inventory table, which is a reasonable.
There was a problem hiding this comment.
Yes, the inventory table is always created with the directory, empty, in the same namespace, and the create response returns its identifier in inventory-table. Creating a directory doesn't trigger a scan: Polaris doesn't scan, the external scanning services populate the inventory table. I clarified this in the createDirectory description and in the doc.
I would not add an option to skip the inventory table now. The inventory table is what makes the objects discoverable through Iceberg. Without it, a directory is only a registered location, as Polaris doesn't vend credentials for the base-location yet. As inventory-table is already optional in Directory, we can add this option later (for the managed volume use case) without breaking clients.
WDYT?
| description: The name of the directory. It is used in REST endpoint paths and is used, followed by the `__inventory` suffix, as the name of the corresponding Iceberg table. | ||
| base-location: | ||
| type: string | ||
| description: The external object store location to use as a root for scanning objects (e.g. s3://bucket/path/). This is where the scanned objects live, not the location of the Iceberg inventory table, which is assigned by Polaris. |
There was a problem hiding this comment.
Does it mean we never allow clients to specify the inventory table location?
In that case, it has to locate under the ns where the directory table exists, which becomes tricky when we allow the base-location be outside of the current namespaces, since it may select a different storage configurations. For example, we may have to vend credential for aws s3 and azure when it comes to the phase we vend credentials for both directory table and its inventory table.
If we allow clients to specify location, it actually hits the same problem.
I think a way to simplify the situation is to let the inventory table always co-locate with the directory base-location, the same parents is probably the easiest thing to do. WDTY?
There was a problem hiding this comment.
Right, clients don't choose the inventory table location for now: Polaris creates the inventory table like any table in the namespace, at the default table location (under the namespace location).
I don't think the inventory table can end up with a different storage configuration than the base-location: the directory and its inventory table are in the same namespace, so they resolve the same storage configuration, and the base-location is validated against its allowed locations. Credential vending for both will go through the same storage configuration.
I'm not sure about co-locating the inventory table with the base-location:
- inside the
base-location, the scan would list the data and metadata files of the inventory table itself, and writing the inventory table would need write access to thebase-location, which is often data that should only be read (for example a bucket written by another team or an ingestion pipeline). - next to the
base-location(same parent), the parent may be outside the allowed locations (or not exist, for a bucket root), and the inventory table could collide with other data.
The default table location avoids these issues. If needed, we can add an optional inventory table location to the create request later, validated like a table location.
WDYT?
| schema: | ||
| $ref: '#/components/schemas/LoadDirectoryResponse' | ||
|
|
||
| ListDirectoriesResponse: |
There was a problem hiding this comment.
I think this wrapper is not needed.
There was a problem hiding this comment.
Which wrapper do you mean?
CreateDirectoryResponseincomponents/responses, which is the same asLoadDirectoryResponse(updateDirectoryalready referencesLoadDirectoryResponsedirectly)? I can remove it.- or the
{"directory": ...}object ofLoadDirectoryResponse? I would keep this one: it followsLoadGenericTableResponse, and leaves room to return the storage credentials for thebase-locationnext to the directory in phase 2 without breaking clients.
There was a problem hiding this comment.
line 428 defines a ListDirectoriesResponse, which refers to line 401 with the same name. Do we need two schema for the same thing?
…d inventory table schema - Document that creating a directory creates its empty inventory table without scanning - Document that dropping a directory drops its inventory table without purge and never deletes the objects under the base location - Describe the base location validation in the spec - Add the inventory table schema and its compatibility rule to the spec
orca-review-bot
left a comment
There was a problem hiding this comment.
Nice split. The spec is easy to read, and the beta label and the external-scanner model match the dev-list direction. Inline comments cover the contract choices that will be hard to change once #5928 builds on them: pagination, error types, how to clear a field on update, and the inventory table sitting inside the scanned prefix.
Comments that don't anchor to a line:
- The PR description is stale. It mentions a
scanendpoint, aStorageAccessConfigmove tocommon-schemas.yaml(it's still ingeneric-tables-api.yaml), and docs for theENABLE_DIRECTORIES/ENABLE_DIRECTORY_SCANflags, and none of these are in the diff. It also doesn't mention the update endpoint. Can we refresh it? directories.mdlands inunreleased/before the endpoints exist. If a release is cut between this PR and #5928, users get docs for an API that returns 404. Can we hold the page, or merge the stack together?- There's no CHANGELOG entry, which is fine for spec only. Can we make sure the beta entry lands with #5928?
- For #5928: since
base-locationreuses table-location validation, can we have tests for the allowed-locations check on create, the deny cases, and the__inventoryname collision?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
| UpdateDirectoryRequest: | ||
| type: object | ||
| description: > | ||
| Fields to update on a directory. Omitted fields are left unchanged. |
There was a problem hiding this comment.
"Omitted fields are left unchanged" means there's no way to remove a scanner-config or a filter once it's set. You'd have to drop and recreate the directory, which also drops the inventory table. Should an explicit null or {} clear the field? Can we say which one in the spec?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
| example: "product-images" | ||
|
|
||
| schemas: | ||
| DirectoryPageToken: |
There was a problem hiding this comment.
Generic-tables and policies reuse the Iceberg page-token/PageToken, and this adds a second pagination contract to the same service. The main difference is that you don't need to send an empty token to start paging. If that's the reason, can we say so in the PR description? Otherwise, can we reuse the Iceberg parameter so the Polaris list APIs stay consistent?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
| $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse' | ||
| 404: | ||
| description: | ||
| Not Found - NoSuchTableError, directory to load does not exist |
There was a problem hiding this comment.
A missing directory is reported as NoSuchTableError. Clients that branch on the error type then can't tell "directory not found" from "table not found". The 409 at line 117 has the same problem. Is that the type the server will return in #5928, or should directories get their own error type while the API is still beta?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
|
|
||
| ### Base location | ||
|
|
||
| The `base-location` is validated like a table location when the directory is created: |
There was a problem hiding this comment.
base-location has to be inside the namespace location, and the inventory table is created in that same namespace. So if base-location is the namespace root, the inventory's own data and metadata files sit inside the scanned prefix, and a scanner will index them into the inventory table. This was one of the must-fix items on the dev list. Can we document how to avoid it (for example with an exclude filter), or require scanners to skip the inventory location?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
| |-------|------|----------|-------------| | ||
| | `name` | `string` | Yes | The name of the directory. It is used in REST endpoint paths and is used, followed by the `__inventory` suffix, as the name of the corresponding Iceberg table. | | ||
| | `base-location` | `string` | Yes | The external object store location to use as a root for scanning objects; this is not the location of the Iceberg inventory table, which is assigned by Polaris (for example `s3://my-bucket/images/`, `gs://my-bucket/docs/`, or `file:///data/local/`). | | ||
| | `scanner-config` | `object` | No | Configuration for the scanning services, such as the filter that controls which objects are added to the directory table during a scan. See [Scanner configuration](#scanner-configuration). | |
There was a problem hiding this comment.
The spec also accepts properties on create, and the update section mentions it, but this table doesn't list it. Can we add a row?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
| - When an engine loads the directory table with [credential vending]({{% ref "vended-credentials" %}}), Polaris | ||
| vends credentials scoped to the directory table location (its data and metadata files), as for any Iceberg | ||
| table. These credentials are not scoped to the directory `base-location`. | ||
| - Privileges on the directory or on the directory table (for example `TABLE_READ_DATA`) don't grant access to the |
There was a problem hiding this comment.
This mentions "privileges on the directory", but the page never says which privileges govern list/create/load/update/drop. Can we name them here, or say they'll be defined in #5928, so admins know what to grant?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
This is the first of three PRs split from #4613, as discussed during the community meeting, to make the review easier:
DirectoryScanServiceSPIDirectories allow users to point Polaris at a location/prefix on an object store (S3, GCS, Azure) containing objects (including unstructured data like images, videos, documents) and track the objects in an Iceberg table with object-level metadata (location, size, content type, checksum, last modified, etc.).
Changes
spec/polaris-catalog-apis/directories-api.yaml: new Directory API under/polaris/v1/{prefix}/namespaces/{namespace}/directories(list, create, load, drop and scan), referenced frompolaris-catalog-service.yaml.StorageAccessConfigmoves fromgeneric-tables-api.yamlto a newcommon-schemas.yaml, so generic tables and directories share the same schema. The generic tables API itself is unchanged.spec/generated/bundled-polaris-catalog-service.yamlis regenerated withspec/bundle.sh.site/content/in-dev/unreleased/directories.md: user documentation for directories.No server code is generated from the new API in this PR:
DirectoryApiis added to the generated APIs in the next PR, together with its implementation.Notes for reviewers
ENABLE_DIRECTORIESandENABLE_DIRECTORY_SCANfeature flags, which land in the next two PRs.Checklist
CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed)