You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "PSaba (via GitHub)" <gi...@apache.org> on 2026/06/08 21:26:51 UTC
[I] Metadata-location is always absent in LoadTableResult when using ?snapshots=refs [polaris]
PSaba opened a new issue, #4656:
URL: https://github.com/apache/polaris/issues/4656
### Describe the bug
`GET /namespaces/{ns}/tables/{table}?snapshots=refs` always returns a LoadTableResult with metadata-location absent, even for tables that have committed snapshots and a known metadata file on storage. The same request with `?snapshots=all` correctly returns metadata-location for the same tables.
### To Reproduce
1. Load any committed Iceberg table — metadata-location is present
```
curl -H "Authorization: Bearer $TOKEN" \
"https://<polaris-host>/api/catalog/v1/<catalog>/namespaces/<ns>/tables/<table>" \
| jq '."metadata-location"'
```
returns `"s3://bucket/path/to/v3.metadata.json"`
2. Same table, add ?snapshots=refs — metadata-location is absent
```
curl -H "Authorization: Bearer $TOKEN" \
"https://<polaris-host>/api/catalog/v1/<catalog>/namespaces/<ns>/tables/<table>?snapshots=refs" \
| jq '."metadata-location"'
```
returns `null`
### Actual Behavior
`metadata-location` is null / absent in the LoadTableResult whenever `?snapshots=refs` is used, regardless of the table's commit history.
### Expected Behavior
`metadata-location `should be populated with the current metadata file path regardless of which `?snapshots` mode is requested. The `?snapshots` parameter controls which snapshots appear in `metadata.snapshots`; it should have no effect on the top-level `metadata-location` pointer, which reflects catalog state, not snapshot history.
### Additional context
Root cause
IcebergCatalogHandler.filterResponseToSnapshots() builds the filtered response like this:
```
TableMetadata filteredMetadata =
metadata.removeSnapshotsIf(s -> !referencedSnapshotIds.contains(s.snapshotId()));
return LoadTableResponse.builder()
.withTableMetadata(filteredMetadata)
.addAllConfig(loadTableResponse.config())
.addAllCredentials(loadTableResponse.credentials())
.build();
```
TableMetadata.removeSnapshotsIf() calls new Builder(this).removeSnapshots(toRemove).build(). Iceberg's TableMetadata.Builder enforces the invariant that metadataFileLocation must be null when the metadata object has pending changes (snapshot
removals count as changes, since the resulting object hasn't been written to a file yet). So filteredMetadata.metadataFileLocation() is always null.
LoadTableResponse.Builder.withTableMetadata() derives metadataLocation solely from tableMetadata.metadataFileLocation() — there is no independent setter for it on the builder. The original metadata-location from the unfiltered response is
silently discarded.
Proposed fix
Add a withMetadataLocation(String) method to LoadTableResponse.Builder in Iceberg, then update filterResponseToSnapshots to explicitly preserve the original value:
```
return LoadTableResponse.builder()
.withTableMetadata(filteredMetadata)
.withMetadataLocation(loadTableResponse.metadataLocation()) // preserve original
.addAllConfig(loadTableResponse.config())
.addAllCredentials(loadTableResponse.credentials())
.build();
```
### System information
Affected endpoint: GET /v1/{prefix}/namespaces/{namespace}/tables/{table}?snapshots=refs
Object storage: S3
Iceberg version: 1.10.x
--
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-unsubscribe@polaris.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Metadata-location is always absent in LoadTableResult when using ?snapshots=refs [polaris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #4656:
URL: https://github.com/apache/polaris/issues/4656#issuecomment-4920951285
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment if you think it's still relevant.
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Metadata-location is always absent in LoadTableResult when using ?snapshots=refs [polaris]
Posted by "vagababov (via GitHub)" <gi...@apache.org>.
vagababov commented on issue #4656:
URL: https://github.com/apache/polaris/issues/4656#issuecomment-4921022284
This is still happening. Moreover I see similar error when requesting tables from Snowflake/Horizon polaris catalogs.
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Metadata-location is always absent in LoadTableResult when using ?snapshots=refs [polaris]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on issue #4656:
URL: https://github.com/apache/polaris/issues/4656#issuecomment-5005428858
It's a valid issue. Thanks for reporting, @PSaba ! Let's get it fixed.
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Metadata-location is always absent in LoadTableResult when using ?snapshots=refs [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b closed issue #4656: Metadata-location is always absent in LoadTableResult when using ?snapshots=refs
URL: https://github.com/apache/polaris/issues/4656
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org