-
Notifications
You must be signed in to change notification settings - Fork 404
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
[#5746] improve(CLI): Support table format output for Audit command #6461
base: main
Are you sure you want to change the base?
Conversation
…mand Support table format output for Audit command.
…mand format the code.
@justinmclean @waukin , could you please review this PR when you have time? I’d really appreciate your feedback. |
…mand Add Table format.
… server Rename the columns.
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.
This PR is a mixture of several changes.
It is about a refactor of the table output format, a beautified version of the table renderer, a change to the audit command and several other things.
Please try your best to make a PR self-contained, atomic.
clients/cli/src/main/java/org/apache/gravitino/cli/commands/ListTables.java
Outdated
Show resolved
Hide resolved
clients/cli/src/main/java/org/apache/gravitino/cli/outputs/BaseOutputFormat.java
Show resolved
Hide resolved
public BaseOutputFormat(CommandContext context) { | ||
Preconditions.checkNotNull(context, "CommandContext cannot be null"); | ||
this.context = context; | ||
this.limit = context.outputLimit(); |
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.
I'm not sure this limit
is gonna be a generic parameter for most commands.
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.
I am worried that too many schemas or tables will affect the display
clients/cli/src/main/java/org/apache/gravitino/cli/outputs/BaseOutputFormat.java
Outdated
Show resolved
Hide resolved
* Represents a column in a formatted table output. Manages column properties including header, | ||
* alignment, and content cells. Handles width calculations. | ||
*/ | ||
public class Column { |
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.
This class can be spit into a separate PR.
|
||
import com.google.common.collect.ImmutableList; | ||
|
||
public class Constant { |
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.
I'm not sure we want to beautify the table output to this extent.
It is meaningless, at least to me.
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.
Instead of changing to a pretty tabular output, it's easier to unit test the output, and instead of writing it directly to std out, this implementation can now unit test the output with a simple mock.
* @throws IllegalArgumentException if the object type is not supported | ||
*/ | ||
public static void output(Object entity, CommandContext context) { | ||
if (entity instanceof Metalake) { |
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.
Please change this long chain of if...else...
into a switch
?
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.
@tengqm JDK8 does not support pattern matching. So we can't use switch-case overwriting.
clients/cli/src/main/java/org/apache/gravitino/cli/outputs/PlainFormat.java
Outdated
Show resolved
Hide resolved
…eOutputFormat.java Co-authored-by: Qiming Teng <[email protected]>
@justinmclean should I and split this pr into several issues? |
… roles is bound to many metadata. (apache#6455) ### What changes were proposed in this pull request? fix issue apache#6238 improve performance when a single role is bound to many metadata. ### Why are the changes needed? Use batch queries when getting role securable object full names instead of loop queries to get each securable object full name. Fix: apache#6238 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Unit tests and integration tests have all passed, this feature has been running internally at Xiaomi for two weeks. Co-authored-by: luoxin5 <[email protected]>
…o configure gvfs-fuse. (apache#6465) ### What changes were proposed in this pull request? Fix the bug of using a relative path to configure gvfs-fuse. ### Why are the changes needed? Fix: apache#6464 ### Does this PR introduce _any_ user-facing change? NO ### How was this patch tested? Manually test
…FSFileSystemProvider` problem (apache#6463) ### What changes were proposed in this pull request? In the current code base, we need to add `catalog-hadoop` to make GVFS client works or class `HDFSFileSystemProvider` and `LocalFileSystemProvider` can't be found. ### Why are the changes needed? It's a bug. Fix: apache#6462 ### Does this PR introduce _any_ user-facing change? N/A ### How was this patch tested? ITs, UTs and test locally.
### What changes were proposed in this pull request? This pr removes outdated tips from `web-ui.md` because, as indicated in the subsequent text, operations such as creating or modifying schemas, tables, or filesets can now be performed through the web UI. ### Why are the changes needed? Remove outdated tips from `web-ui.md` ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? manual review
…on parameters through environment variables (apache#6458) ### What changes were proposed in this pull request? Add the environment variables `GRAVITINO_JDBC_USER`, `GRAVITINO_JDBC_PASSWORD`, and `GRAVITINO_S3_ENDPOINT` to the `rewrite_config.py`, so database user and password can be set by the user in a container environment as well as a custom S3 endpoint. ### Why are the changes needed? Currently, JDBC user and PW are hardcoded to `iceberg` and cannot be changed when using the container images. One workaround is including the values in the JDBC connection string, but this neither elegant nor in line with how containers commonly handle this issue. Additionally, it wasn't possible to set the value of `gravitino.iceberg-rest.s3-endpoint` in a container environment, which can be useful in a variety of situations when using a provider other than AWS. ### Does this PR introduce _any_ user-facing change? Added the three aforementioned two environment variables that can be used by the user. ### How was this patch tested? Was tested locally only, since this is a minimal change.
…mand Support table format output for Audit command.
…mand fix some bugs.
@@ -32,6 +32,8 @@ public class CommandContext { | |||
private final boolean quiet; | |||
private final CommandLine line; | |||
private final String auth; | |||
// TODO make it final | |||
private int outputLimit; |
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.
can it be made final?
@@ -55,6 +57,7 @@ public CommandContext(CommandLine line) { | |||
? line.getOptionValue(GravitinoOptions.OUTPUT) | |||
: Command.OUTPUT_FORMAT_PLAIN; | |||
this.quiet = line.hasOption(GravitinoOptions.QUIET); | |||
this.outputLimit = -1; |
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.
It's unclear to me what this is for - perhaps it needs a better name or better still in another PR
@@ -106,7 +106,7 @@ public void testMetalakeListCommand() { | |||
String output = new String(outputStream.toByteArray(), StandardCharsets.UTF_8).trim(); | |||
assertEquals( | |||
"+-------------+\n" | |||
+ "| metalake |\n" | |||
+ "| METALAKE |\n" |
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.
Please don't change the headings to all capitals it makes it harder to read
Yep I think multiple PRs would be better as this one PR is trying to do too much |
What changes were proposed in this pull request?
Why are the changes needed?
Fix: #5746
Does this PR introduce any user-facing change?
No
How was this patch tested?
local test + ut