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
HBASE-24901 Create versatile hbase-shell table formatter #2282
base: master
Are you sure you want to change the base?
Conversation
- Add new abstract ::Shell::Formatter::TableFormatter implemented by AlignedTableFormatter, UnalignedTableFormatter, and JsonTableFormatter - Create ::Shell::Formatter::Util with common helper methods like to_iso_8601 and set_text_width. - Create formatting mixins for commands with similar output requirements including snapshots and cell scanners.
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skimmed. Its lovely.
How does json formatter deal w/ binary chars?
The JSON formatter takes advantage of Ruby's builtin |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
- Switch default TableFormatter to UnalignedTableFormatter. The current implementation of AlignedTableFormatter will truncate output cells that are too long, so it is not the best formatter to use by default. - Remove extra specifications of num_cols from commands and allow TableFormatter to derive this attribute from headers and widths. - Set default padding of UnalignedTableFormatter to zero - Document AlignedTableFormatter#refresh_column_widths - Use TableFormatter for list command - Add formatter note to in-shell help - Add more testing of the three TableFormatter implementations - Remove TableFormatterAdapter. It was nice to use during development, but I think having it around will only cause confusion in the future. It is better for commands to specifically opt-in to using the new TableFormatter.
- Expose all the TableFormatter toggles as keyword arguments to set_formatter - Refactor TableFormatter to be more reusable such that we only instantiate one instance of TableFormatter for the entire shell - Switch default formatter to AlignedTableFormatter, but change the default options to have no border and allow overflow. This will be more familiar to users - Address a few rubocop issues
I updated the patch so that the default table formatter is much closer in output to the old style. The output is aligned, but with no borders and no values will be truncated. Instead, long values will just make the line longer (and will no longer line up with their respective column headers). I'll post some more screenshots in Jira shortly. |
🎊 +1 overall
This message was automatically generated. |
- Use instance variable @widths instead of previous access pattern in AlignedTableFormatter
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
- Allow TableFormatter#start_table and TableFormatter#close_table to take keyword arguments - Rewrite set_formatter as instance of Command class - Add compatibility option to set_formatter called "old school" and adapt all commands to respect this option
For compatibility, I added an option to use the HBase 1 formatter via old_school is enabled by default |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Resolves https://issues.apache.org/jira/browse/HBASE-24901
Changelog
AlignedTableFormatter, UnalignedTableFormatter, and JsonTableFormatter
and set_text_width.
including snapshots and cell scanners.