Skip to content

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

Open
smaheshwar-pltr wants to merge 3 commits into
mainfrom
rest-fileio-fallback
Open

fix(rest): resolve a FileIO without io-impl or warehouse configured#13
smaheshwar-pltr wants to merge 3 commits 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 infers the implementation in order io-impl > the table's metadata-location scheme > warehouse scheme > local. The metadata location is threaded through TableFileIO.

Why

A catalog that relies solely on vended storage credentials carries no client-side io-impl/warehouse, so both factories previously failed and such a catalog could be neither created nor used.

Selecting the table FileIO from the metadata-location scheme mirrors PyIceberg's load_file_io, which picks the FileIO from the metadata-location scheme (then the warehouse):

(Java reaches the same outcome differently — a single ResolvingFileIO that resolves per file operation — so it is not the precedent for this load-time selection.)

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

  • Precedence is metadata-location before warehouse — also more robust to a logical (non-URI) warehouse name.
  • An unsupported metadata-location scheme fails fast, rather than silently building a warehouse-derived FileIO that could not read the table anyway.
  • Like a graceful fallback, an unconfigured remote catalog degrades to a local FileIO rather than failing at creation.
  • Deferred edge (kept minimal): a table returning no config/credentials but a remote metadata-location still reuses the catalog FileIO; resolving that is a follow-up.

MakeCatalogFileIO and MakeTableFileIO previously returned InvalidArgument when
neither "io-impl" nor "warehouse" was configured, preventing a catalog that
relies solely 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 be created;
  per-table resolution supplies remote access.
- MakeTableFileIO infers the implementation from "io-impl", then the table's
  metadata-location scheme, then the "warehouse" scheme, else local. The
  metadata location is threaded through TableFileIO. This mirrors PyIceberg's
  load_file_io, which selects the FileIO from the metadata-location scheme.

Adds tests for metadata-location detection, precedence over a (logical)
warehouse, and the local fallback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
RestCatalogProperties::kWarehouse.key());
if (!metadata_location.empty()) {
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.

Selecting the table FileIO from the metadata-location scheme (then the warehouse) mirrors PyIceberg's load_file_io, so a catalog that vends credentials works without a client-side io-impl/warehouse:

(Java reaches the same outcome differently — a single ResolvingFileIO that resolves per file operation — so it isn't the precedent for this load-time selection.)

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