-
Notifications
You must be signed in to change notification settings - Fork 409
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
[#6481] improve(CLI): Refactor table output format #6483
[#6481] improve(CLI): Refactor table output format #6483
Conversation
Refactor table output format, make it easier to test and scale.
Rename the constant.
Hi @justinmclean could you please review this PR when you have time? I’d really appreciate your feedback. |
clients/cli/src/main/java/org/apache/gravitino/cli/CommandContext.java
Outdated
Show resolved
Hide resolved
In the plain form test, why does the output have #s in front of each line? |
clients/cli/src/main/java/org/apache/gravitino/cli/outputs/BaseOutputFormat.java
Show resolved
Hide resolved
clients/cli/src/main/java/org/apache/gravitino/cli/outputs/BaseOutputFormat.java
Show resolved
Hide resolved
clients/cli/src/main/java/org/apache/gravitino/cli/outputs/PlainFormat.java
Outdated
Show resolved
Hide resolved
clients/cli/src/main/java/org/apache/gravitino/cli/outputs/PlainFormat.java
Outdated
Show resolved
Hide resolved
*/ | ||
public TableFormat(CommandContext context) { | ||
super(context); | ||
// TODO: add other options for TableFormat |
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.
What other options?
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.
Like sort or limit?
clients/cli/src/main/java/org/apache/gravitino/cli/outputs/TableFormat.java
Outdated
Show resolved
Hide resolved
clients/cli/src/main/java/org/apache/gravitino/cli/outputs/TableFormat.java
Outdated
Show resolved
Hide resolved
fix some code.
I manually added the # sign to distinguish between commands and results. |
@justinmclean I’ve finished updating the code. Please take a look at the PR again when you have time. |
@justinmclean should we add table, schema list\detail command Table output in this pr? or create a new one? |
I would do it in a new PR - there are enough changes here. |
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.
LGTM - thanks again for your contributions
### What changes were proposed in this pull request? Refactor table output format, make it easier to test and scale. ### Why are the changes needed? Fix: apache#6481 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? table format test ```bash gcli metalake list -i --output table +-------------------+ | Metalake | +-------------------+ | demo | | cli_demo | | demo_metalake | | test_cli_metalake | | tyy | | demo3 | +-------------------+ gcli metalake details -i --output table -m demo_metalake +---------------+-------------+ | Metalake | Comment | +---------------+-------------+ | demo_metalake | new comment | +---------------+-------------+ gcli catalog list -i --output table -m demo_metalake +-------------------+ | Catalog | +-------------------+ | File | | Hive_catalog | | Iceberg_catalog | | Mysql_catalog | | Test_hive_catalog | +-------------------+ gcli catalog details --name Hive_catalog -i --output table -m demo_metalake +--------------+------------+----------+-------------+ | Catalog | Type | Provider | Comment | +--------------+------------+----------+-------------+ | Hive_catalog | RELATIONAL | hive | new comment | +--------------+------------+----------+-------------+ ``` plainformat test ```bash gcli metalake list -i # demo # cli_demo # demo_metalake # test_cli_metalake # demo3 gcli metalake details -i -m demo_metalake # demo_metalake, new comment gcli catalog list -i -m demo_metalake # File # Hive_catalog # Iceberg_catalog # Mysql_catalog # Test_hive_catalog gcli catalog details --name Hive_catalog -i -m demo_metalake # Hive_catalog, RELATIONAL, hive, new comment ```
What changes were proposed in this pull request?
Refactor table output format, make it easier to test and scale.
Why are the changes needed?
Fix: #6481
Does this PR introduce any user-facing change?
No
How was this patch tested?
table format test
plainformat test