Skip to content
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

CLI needs option to truncate field output instead of wrapping it #3336

Closed
rmoff opened this issue Sep 12, 2019 · 1 comment · Fixed by #3341
Closed

CLI needs option to truncate field output instead of wrapping it #3336

rmoff opened this issue Sep 12, 2019 · 1 comment · Fixed by #3341

Comments

@rmoff
Copy link
Contributor

rmoff commented Sep 12, 2019

The new table view in 5.4 is 😍but it causes problems of its own if a field has long values, since the entire value is shown and usually ends up wrapping, which can end up taking many lines of its own - thus making the data almost as unreadable as when it was not rendered as a table.

This is a mild example, showing how three records are rendered over seven lines:

ksql> SELECT STARS, CHANNEL, MESSAGE FROM RATINGS ;
+----------------------------+----------------------------+----------------------------+
|STARS                       |CHANNEL                     |MESSAGE                     |
+----------------------------+----------------------------+----------------------------+
|2                           |iOS                         |Surprisingly good, maybe you|
|                            |                            | are getting your mojo back |
|                            |                            |at long last!               |
|1                           |iOS                         |airport refurb looks great, |
|                            |                            |will fly outta here more!   |
|3                           |iOS-test                    |Exceeded all my expectations|
|                            |                            |. Thank you !               |

As well as being difficult to read I think it is confusing for the user as it 'feels' wrong to see more lines for fewer data, by default.

We should seek inspiration from something like sql*plus which has very advanced options on how to configure output (line size, column size, truncate or not, etc). For moment I think there should be a CLI property to enable truncation (which should be set by default, and people can enable wrapping if they want to). The output for the above data would then look like this:

ksql> SELECT STARS, CHANNEL, MESSAGE FROM RATINGS ;
+----------------------------+----------------------------+----------------------------+
|STARS                       |CHANNEL                     |MESSAGE                     |
+----------------------------+----------------------------+----------------------------+
|2                           |iOS                         |Surprisingly good, maybe you[…]|
|1                           |iOS                         |airport refurb looks great, […]|
|3                           |iOS-test                    |Exceeded all my expectations[…]|
@rmoff
Copy link
Contributor Author

rmoff commented Sep 12, 2019

The above example also shows why dynamic/configurable field widths would be so helpful, because not only is there wasted horizontal space on the STARS and CHANNEL fields, but also it makes it harder to read because there's a long gap between values when reading left to right.

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 a pull request may close this issue.

1 participant