TTyChud opened a new pull request, #25785:
URL: https://github.com/apache/datafusion/pull/25785
## Which issue does this PR close?
- Closes #25627.
## Rationale for this change
`CreateExternalCatalog` and `DropCatalog` can only be built with a struct
literal, so call sites have to pass all seven fields, including a `schema`
that
is always `Arc::new(DFSchema::empty())`. #19066 added a builder for
`CREATE EXTERNAL TABLE` for the same reason; this adds one for the catalog
structs too.
## What changes are included in this PR?
- `CreateExternalCatalog::builder(catalog_name, catalog_type)` and
`DropCatalog::builder(name)`, with `with_*` setters for the remaining
fields
and `build()`. `schema` defaults to an empty `DFSchema`.
- The two construction sites in `datafusion/sql/src/statement.rs`
(`DROP CATALOG` / `DROP DATABASE` and `CREATE EXTERNAL CATALOG`) now use
them.
- `Hash` / `PartialOrd` are untouched, so plan comparison is unchanged.
## What is the testing strategy for this PR?
The doc examples added to both `builder` methods are the behavioural coverage
for construction: `cargo test -p datafusion-expr --doc` passes 62 tests,
including `CreateExternalCatalog::builder` and `DropCatalog::builder`.
The rest of the change is API shape, so the local checks were:
```sh
cargo fmt --all -- --check
cargo check -p datafusion-sql
cargo clippy -p datafusion-expr -p datafusion-sql --all-targets --no-deps --
-D warnings
```
All clean. The SQL-level catalog tests are unchanged and are exercised by CI:
the `create_drop_catalog` cases in `datafusion/core/tests/sql/create_drop.rs`
and the catalog cases in `datafusion/sqllogictest/test_files/ddl.slt`. I have
not run those locally (the core test target is not built in my checkout).
## Are there any user-facing changes?
New public API in `datafusion-expr`, additive only: two builder types and
their
`builder` constructors. No existing API is removed or changed.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]