-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Use pager and allow configuration via \pset
#15597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Since pset must now also control pager, move 'format' to a subcommand of pset (where it should have been to start with). Also under pset, activate other settings that make sense.
@djellemah thank you for working on this! Can we also add some tests to not break these features in the future? and there are some failures in CI |
This PR has several CI failures so marking as a draft while they are addressed. |
I've added commits to address the CI failures. Of course you're welcome to add some tests to not break these features in the future :-) |
Thank you for this contribution @djellemah -- it is a very nice feature to have
As documented in the contribution guidelines https://datafusion.apache.org/contributor-guide/testing.html#testing
Thus I agree with @berkaysynnada that this feature should have tests before we merge it. Since maintainer bandwidth is the most limited resource in this project, I suspect we might be waiting a while if we wait for a maintainer help write tests |
On f36029c, I added a test to verify the CLI execution on the pty. However, testing key presses like ‘w’ or ‘s’ in the test is tricky, and there’s additional complexity with waiting for other tests to finish. |
Seems to me there's a confluence of several factors here:
In my opinion, the decision matrix here is not quite the same as one would apply to core functionality. |
Which issue does this PR close?
Rationale for this change
Explained in issue. Common in other cli programs implementing querying of data.
What changes are included in this PR?
Add a pager (
less
by default). Check that it exists. Use it for query output.Allow some manipulation of which pager program is used, and what its command line arguments are, via
\pset
(followingpsql
usage of\pset
)Allow use of pager to be switched off.
Do not use a pager if stdout is redirected to a non-tty.
Are these changes tested?
Not in unit tests.
Are there any user-facing changes?
Yes. The purpose of these changes is to improve UX.
Not certain if the change from specifying format using
\pset csv
to usingpset format csv
is considered a breaking change.In any case,
\pset
appears to come frompsql
, which uses subcommands to specify several areas of output configuration, one of which ispager
.datafusion-cli
should therefore have used\pset format whatever
from the outset.