Skip to content

refactor: return Result from fallible catalog and schema methods#21944

Open
gratus00 wants to merge 2 commits intoapache:mainfrom
gratus00:fix-21778-catalog-schema-result
Open

refactor: return Result from fallible catalog and schema methods#21944
gratus00 wants to merge 2 commits intoapache:mainfrom
gratus00:fix-21778-catalog-schema-result

Conversation

@gratus00
Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

Several CatalogProvider and SchemaProvider methods are fallible in practice, but their signatures do not currently return Result. That forces implementations and callers to either hide errors or treat fallible operations as infallible.

This change makes those fallible paths explicit so errors can be propagated correctly through the catalog API and its downstream callers.

What changes are included in this PR?

This PR updates the following methods to return Result:

  • CatalogProvider::schema_names
  • CatalogProvider::schema
  • SchemaProvider::table_names
  • SchemaProvider::table_exist

It also propagates those signature changes through the relevant implementations and call sites, including:

  • in-memory and listing catalog/schema providers
  • async catalog/schema wrappers
  • information schema and dynamic file catalog code
  • session/context catalog access paths
  • FFI catalog/schema wrappers
  • sqllogictest and example code
  • affected tests

Are these changes tested?

Yes.

The following commands were run locally:

cargo fmt --all
TMPDIR=/tmp cargo check -p datafusion-catalog -p datafusion-ffi -p datafusion-cli -p datafusion-examples -p datafusion-sqllogictest -p datafusion
TMPDIR=/tmp cargo test -p datafusion-catalog --lib
TMPDIR=/tmp cargo test -p datafusion-ffi --lib
TMPDIR=/tmp cargo test -p datafusion memory_catalog_dereg_nonempty_schema
TMPDIR=/tmp cargo test -p datafusion test_mem_provider
TMPDIR=/tmp cargo check -p datafusion-examples --example udf
TMPDIR=/tmp cargo clippy -p datafusion --lib -- -D warnings

Are there any user-facing changes?

There are no end-user SQL or CLI behavior changes.

This is a public API change for implementers of CatalogProvider and SchemaProvider, so the api change label should be added.

@github-actions github-actions Bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) catalog Related to the catalog crate ffi Changes to the ffi crate labels Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

catalog Related to the catalog crate core Core DataFusion crate ffi Changes to the ffi crate sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Result return types to CatalogProvider / SchemaProvider fallible methods

1 participant