Cli entrypoint pr2#23466
Open
ratmice wants to merge 3 commits into
Open
Conversation
ratmice
commented
Jul 10, 2026
| pub fn builder() -> CliSessionBuilder { | ||
| CliSessionBuilder::default() | ||
| } | ||
| pub async fn entry_point() -> Result<(), CliError> { |
Author
There was a problem hiding this comment.
Perhaps some bikeshedding here...
I'm not totally enamored with the name, but it seemed descriptive,
we could I guess impl default and use CliSession::default().run().await? instead
of having this entry_point function I suppose.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
In order for a provider of custom UDF (libaries such as geodatafusion) to get a version equivalent to datafusion-cli which registers their UDF and extensions, they currently need to reimplement a lot of argument parsing, which is a lot of boiler plate.
While this PR tries to reduce the amount of boiler plate, it also tries to make it more flexible so that downstream can add
their own arguments (see the included cli-custom-udf example).
What changes are included in this PR?
Refactor the
main_innerfunction into aCliSessiontype, export theArgstype publicly asCliArgs.Migrate the to using
thiserroras the todo suggests, since we're now mixingclapanddatafusionerrors.This patch doesn't modify prior library functions. It moves some binary functions into a library new module.
But there isn't any changes to any existing library functions.
Existing examples now respond to arguments e.g.
cargo run --example cli-session-context -- --helpAre these changes tested?
The existing datafusion-cli binary, new and existing examples, have been tested from the command line.
Because this example duplicates each output row an additional time:
Are there any user-facing changes?
There are no breaking changes, should be semver compatible. This just adds API on top of the existing library,
it migrates the example, so it can benefit from argument parsing, but existing binaries using the library should
be unaffected in any way.