Move datafusion-cli main_inner impl into the datafusion-cli lib.#23387
Move datafusion-cli main_inner impl into the datafusion-cli lib.#23387ratmice wants to merge 4 commits into
Conversation
Unformatted to ease review. This also adds an example of reusing the main datafusion-cli while registering custom udf.
|
Hmm, I'm uncertain how to make this patch look nice in the github review UI. It looks okay in my local git history viewer, but afaict github really wants to display them squashed? |
|
After sleeping on it, there are definitely a few things this patch could do better.
Mostly fixed in 249072e, except the first point which I'm not sure needs to be done and seems minor to me. |
|
So the only thing I'm a bit uncertain/hesitant about (I'm really not all that familiar with Edit: After thinking about, this seemed like I should just do this now as it seemed inevitable, and it's better if we don't have to break semver later to handle it. Fixed in e3d941a |
|
Alright I think this has ended up in a reasonable state (modulo bike shedding), and I can't imagine anything else (crosses fingers), so I believe it should be ready for review |
Which issue does this PR close?
Closes #23386.
Rationale for this change
Customizing datafusion-cli with custom udf or calling
register_*currently requires copying all ofmain.rs,then dealing with the workspace dependencies required to build it, and change it to link against the
datafusion-clilibrary.If one just wants an example cli without much hassle and maintenance, it is a bit much when you hope to just add a couple lines.
What changes are included in this PR?
The first patch moves a lot of main_inner to a new struct
ClientSession, that then makes it a lot simpler.Included is an example of registering a cli-custom-udf.rs.
The second patch just reformats the code with rustfmt to deal with the addition of indentation by moving
things into an
impl CliSession.Are these changes tested?
I tested these by running the
datafusion-cliand runningselect hello(1);in the new example.Otherwise this doesn't change any existing library code.
Are there any user-facing changes?