Skip to content

fix(rest): resolve a FileIO without io-impl or warehouse configured#13

Open
smaheshwar-pltr wants to merge 1 commit into
mainfrom
rest-fileio-fallback
Open

fix(rest): resolve a FileIO without io-impl or warehouse configured#13
smaheshwar-pltr wants to merge 1 commit into
mainfrom
rest-fileio-fallback

Conversation

@smaheshwar-pltr

@smaheshwar-pltr smaheshwar-pltr commented Jun 27, 2026

Copy link
Copy Markdown
Owner

What

Resolve a REST catalog FileIO when neither io-impl nor warehouse is configured:

  • MakeCatalogFileIO falls back to a local FileIO (instead of returning InvalidArgument).
  • MakeTableFileIO resolves the implementation in order io-impl > warehouse scheme > the table's metadata-location scheme, else local. The metadata location is threaded through TableFileIO.

Why

A catalog that relies on vended credentials carries no client-side io-impl/warehouse, so both factories previously failed and such a catalog could be neither created nor used. This mirrors how Java and PyIceberg resolve a FileIO from the location scheme (with a graceful fallback) rather than requiring a warehouse:

Why one PR (not two)

The two changes are one capability and are non-functional apart: with only the MakeCatalogFileIO fallback a vended-table load still throws in MakeTableFileIO; and the metadata-location branch is unreachable without the catalog fallback (a configured catalog's merged config always carries io-impl/warehouse). Splitting would ship dead code.

Notes / follow-ups

  • Like Java's ResolvingFileIO fallback, an unconfigured remote catalog now degrades to a local FileIO rather than failing fast, so a genuine misconfiguration surfaces later. Deliberate, for parity.
  • Deferred edge (kept minimal): a table with no config/credentials but a remote metadata location still reuses the catalog FileIO; resolving that is a follow-up.

Result<std::shared_ptr<FileIO>> RestCatalog::TableFileIO(
const SessionContext& /*context*/,
const std::unordered_map<std::string, std::string>& table_config,
std::string_view metadata_location,

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we even need this change for this PR? Doesn't the change of MakeCatalogFileIO not throwing solve our use case alone and it'd keep the PR smaller? Also, look for comments on the original upstream PR to see if there are any notes about our scenario at all

MakeCatalogFileIO and MakeTableFileIO previously returned InvalidArgument
when neither "io-impl" nor "warehouse" was configured, preventing catalogs
that rely entirely on vended storage credentials (no client-side IO config)
from being created or loading tables.

Now:
- MakeCatalogFileIO falls back to a local FileIO so the catalog can still be
  created; per-table resolution supplies remote access where needed.
- MakeTableFileIO resolves the implementation in priority order: io-impl,
  warehouse scheme, then the table's metadata-location scheme, falling back
  to a local FileIO. The metadata location is threaded through TableFileIO so
  the scheme comes from the table's actual location rather than a
  storage-credential prefix (which may be scheme-only, e.g. "s3").

Updates the catalog test for the new fallback and adds table-FileIO tests
for metadata-location detection (with a scheme-only credential prefix) and
the local fallback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
// from the table's metadata location so catalogs that rely solely on
// vended credentials can resolve a table FileIO.
ICEBERG_ASSIGN_OR_RAISE(const auto detected_kind,
DetectBuiltinFileIO(metadata_location));

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant