Skip to content

fix: stop enabling DataFusion default features in iceberg-datafusion - #155

Open
dragonknightk wants to merge 3 commits into
apache:mainfrom
dragonknightk:fix/136
Open

dragonknightk wants to merge 3 commits into
apache:mainfrom
dragonknightk:fix/136

Conversation

@dragonknightk

@dragonknightk dragonknightk commented Dec 2, 2026 •

Copy link
Copy Markdown

Closes #136.

Rationale for this change

iceberg-datafusion depended on datafusion with its default features, which include sql, even though the library never uses SQL. Cargo unifies features across a build, so every downstream project depending on iceberg-datafusion also gets sql.

That breaks projects that build DataFusion without sql. With sql on, DataFusionError gains a SQL variant, so an exhaustive match on DataFusionError fails to compile.

Workspace-only CI commands (--workspace) do not catch regressions because workspace dev-dependencies and tooling crates turn sql back on via feature unification.

What changes are included in this PR?

  • Disable DataFusion default features in the workspace declaration, leaving iceberg-datafusion with no extra DataFusion features.
  • Enable parquet and sql explicitly where directly used: iceberg-datafusion-test-tools (Parquet re-export and SessionContext::sql in the harness) and iceberg-datafusion dev-dependencies (tests only, excluded from downstream builds). iceberg-sqllogictest and iceberg-playground do not call SessionContext::sql directly and remain unchanged.
  • Add cargo check --locked -p iceberg-datafusion --lib to the existing CI Clippy job so future library changes that rely on DataFusion default features fail CI.
  • Change the datafusion::sql::planner::SqlToRel::external_table_to_plan doc reference in factory.rs from an intra-doc link to plain inline code, since datafusion::sql is absent without sql.

Are these changes tested?

  • Library isolation: verified that iceberg-datafusion --lib compiles without DataFusion default features and that its normal dependency tree for datafusion-common no longer includes sql.
  • Documentation: verified strict rustdoc build for iceberg-datafusion passes with no unresolved intra-doc links in the modified code.
  • Workspace and downstream compatibility: full workspace tests and clippy pass; a downstream crate matching all non-sql DataFusionError variants fails with a non-exhaustive match on SQL before this PR and compiles after it.

Are there any user-facing changes?

Yes. iceberg-datafusion no longer enables any DataFusion default feature (sql, parquet, compression codecs, and so on) for downstream builds. A project relying on any of those features must enable it on its own datafusion dependency.

AI Disclosure

Grok Bot, working for dragonknightk, assisted with the changes, the description, and the verification. All content was reviewed by a human, and the submitter understands and can maintain these changes.

Closes issue 136.

## Rationale for this change

`iceberg-datafusion` depended on `datafusion` with its default features, which include `sql`, although the library never uses SQL. Cargo unifies features across a build, so every project that depends on `iceberg-datafusion` also gets `sql`.

That breaks projects that build DataFusion without `sql`. With `sql` on, `DataFusionError` gains a `SQL` variant, so a `match` that lists every variant no longer compiles.

## What changes are included in this PR?

The workspace now declares `datafusion` with `default-features = false`, and the library enables no extra features. The crates that need more ask for it themselves:

- `iceberg-datafusion-test-tools` enables `sql` (its harness calls `SessionContext::sql`) and `parquet` (it uses the Parquet re-export).
- The library enables `parquet` and `sql` for its own tests as a dev-dependency only, so they are not part of a downstream build.

## Are these changes tested?

This only changes manifests, so there is no new test. `cargo test -p iceberg-datafusion` still passes.

A small downstream crate (not part of this PR) builds `datafusion-common` without `sql` and matches every `DataFusionError` variant. Before this change it fails with a non-exhaustive match on `SQL`. After it, it compiles. `cargo tree -e normal,features -i datafusion-common -p iceberg-datafusion` no longer lists `sql`.

## Are there any user-facing changes?

Yes. `iceberg-datafusion` no longer turns on any DataFusion default feature (`sql`, `parquet`, compression codecs, and so on) for downstream builds. A project that relied on it for one of them must enable that feature on its own `datafusion` dependency.

Signed-off-by: dragonknightk <37928252+dragonknightk@users.noreply.github.com>
@NoahKusaba

Copy link
Copy Markdown
Contributor

Quick AI pass, as I can see this merging --> You will need to rebase

  1. CI builds --workspace, where datafusion-sqllogictest and datafusion-cli turn the features back on, so a library change that needs sql would still pass CI. Could CI also run cargo check --locked -p iceberg-datafusion --lib?
  2. sqllogictest and playground call SessionContext::sql but get sql only through those crates. Worth adding features = ["sql"] to them, as in test-tools.

Nit: the SqlToRel::external_table_to_plan doc link in table_provider/factory.rs:193 no longer resolves without sql.

Signed-off-by: dragonknightk <37928252+dragonknightk@users.noreply.github.com>
Closes issue 136.

## Rationale for this change

`iceberg-datafusion` depended on `datafusion` with its default features, which include `sql`, even though the library never uses SQL. Cargo unifies features across a build, so every downstream project depending on `iceberg-datafusion` also gets `sql`.

That breaks projects that build DataFusion without `sql`. With `sql` on, `DataFusionError` gains a `SQL` variant, so an exhaustive `match` on `DataFusionError` fails to compile.

Workspace-only CI commands (`--workspace`) do not catch regressions because workspace dev-dependencies and tooling crates turn `sql` back on via feature unification.

## What changes are included in this PR?

- Disable DataFusion default features in the workspace declaration, leaving `iceberg-datafusion` with no extra DataFusion features.
- Enable `parquet` and `sql` explicitly where directly used: `iceberg-datafusion-test-tools` (Parquet re-export and `SessionContext::sql` in the harness) and `iceberg-datafusion` dev-dependencies (tests only, excluded from downstream builds). `iceberg-sqllogictest` and `iceberg-playground` do not call `SessionContext::sql` directly and remain unchanged.
- Add `cargo check --locked -p iceberg-datafusion --lib` to the existing CI Clippy job so future library changes that rely on DataFusion default features fail CI.
- Change the `datafusion::sql::planner::SqlToRel::external_table_to_plan` doc reference in `factory.rs` from an intra-doc link to plain inline code, since `datafusion::sql` is absent without `sql`.

## Are these changes tested?

- Library isolation: verified that `iceberg-datafusion --lib` compiles without DataFusion default features and that its normal dependency tree for `datafusion-common` no longer includes `sql`.
- Documentation: verified strict rustdoc build for `iceberg-datafusion` passes with no unresolved intra-doc links in the modified code.
- Workspace and downstream compatibility: full workspace tests and clippy pass; a downstream crate matching all non-`sql` `DataFusionError` variants fails with a non-exhaustive match on `SQL` before this PR and compiles after it.

## Are there any user-facing changes?

Yes. `iceberg-datafusion` no longer enables any DataFusion default feature (`sql`, `parquet`, compression codecs, and so on) for downstream builds. A project relying on any of those features must enable it on its own `datafusion` dependency.

Signed-off-by: dragonknightk <37928252+dragonknightk@users.noreply.github.com>
@dragonknightk

Copy link
Copy Markdown
Author

@NoahKusaba Thanks for taking a look! Merged main to resolve the conflict, added cargo check --locked -p iceberg-datafusion --lib to CI, and fixed the doc link in factory.rs.

I left sqllogictest and playground untouched since neither actually calls SessionContext::sql directly. They just hand the context off to datafusion-sqllogictest and datafusion-cli, which already bring in sql themselves.

@NoahKusaba NoahKusaba left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good going to approve. One last suggestion that is nice to have.

Adding features = ["sql"] to the library makes the new cargo check step pass again, which brings back #136. Could CI also check that the library doesn't turn sql on? This fails on main and passes here:

test -z "$(cargo tree --locked -p iceberg-datafusion -e normal -i sqlparser)"

SQL support could still come later as an opt-in sql feature of iceberg-datafusion.

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.

SQL feature should not be required for entire workspace

2 participants