-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-416] improve hint information for cli #1110
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
Changes from all commits
bdd0e3b
2e91db1
c6ff8f7
7abd993
53424d2
29906cd
9b36658
c85109b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ public class HoodieCLI { | |
| public static FileSystem fs; | ||
| public static CLIState state = CLIState.INIT; | ||
| public static String basePath; | ||
| public static HoodieTableMetaClient tableMetadata; | ||
| protected static HoodieTableMetaClient tableMetadata; | ||
| public static HoodieTableMetaClient syncTableMetadata; | ||
| public static TimelineLayoutVersion layoutVersion; | ||
|
|
||
|
|
@@ -92,4 +92,17 @@ public static void connectTo(String basePath, Integer layoutVersion) { | |
| setLayoutVersion(layoutVersion); | ||
| refreshTableMetadata(); | ||
| } | ||
|
|
||
| /** | ||
| * Get tableMetadata, throw NullPointerException when it is null. | ||
| * | ||
| * @return tableMetadata which is instance of HoodieTableMetaClient | ||
| */ | ||
| public static HoodieTableMetaClient getTableMetaClient() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor: can you add java docs. |
||
| if (tableMetadata == null) { | ||
| throw new NullPointerException("There is no hudi dataset. Please use connect command to set dataset first"); | ||
| } | ||
| return tableMetadata; | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,6 @@ | |
| import org.apache.hadoop.fs.FileStatus; | ||
| import org.apache.hadoop.fs.Path; | ||
| import org.springframework.shell.core.CommandMarker; | ||
| import org.springframework.shell.core.annotation.CliAvailabilityIndicator; | ||
| import org.springframework.shell.core.annotation.CliCommand; | ||
| import org.springframework.shell.core.annotation.CliOption; | ||
| import org.springframework.stereotype.Component; | ||
|
|
@@ -53,11 +52,6 @@ | |
| @Component | ||
| public class ArchivedCommitsCommand implements CommandMarker { | ||
|
|
||
| @CliAvailabilityIndicator({"show archived commits"}) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, can you help me understand what purpose does the annotation serve. also, are we removing it since this is unused?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
| public boolean isShowArchivedCommitAvailable() { | ||
| return HoodieCLI.tableMetadata != null; | ||
| } | ||
|
|
||
| @CliCommand(value = "show archived commit stats", help = "Read commits from archived files and show details") | ||
| public String showArchivedCommits( | ||
| @CliOption(key = {"archiveFolderPattern"}, help = "Archive Folder", unspecifiedDefaultValue = "") String folder, | ||
|
|
@@ -68,7 +62,7 @@ public String showArchivedCommits( | |
| unspecifiedDefaultValue = "false") final boolean headerOnly) | ||
| throws IOException { | ||
| System.out.println("===============> Showing only " + limit + " archived commits <==============="); | ||
| String basePath = HoodieCLI.tableMetadata.getBasePath(); | ||
| String basePath = HoodieCLI.getTableMetaClient().getBasePath(); | ||
| Path archivePath = new Path(basePath + "/.hoodie/.commits_.archive*"); | ||
| if (folder != null && !folder.isEmpty()) { | ||
| archivePath = new Path(basePath + "/.hoodie/" + folder); | ||
|
|
@@ -146,7 +140,7 @@ public String showCommits( | |
| throws IOException { | ||
|
|
||
| System.out.println("===============> Showing only " + limit + " archived commits <==============="); | ||
| String basePath = HoodieCLI.tableMetadata.getBasePath(); | ||
| String basePath = HoodieCLI.getTableMetaClient().getBasePath(); | ||
| FileStatus[] fsStatuses = | ||
| FSUtils.getFs(basePath, HoodieCLI.conf).globStatus(new Path(basePath + "/.hoodie/.commits_.archive*")); | ||
| List<Comparable[]> allCommits = new ArrayList<>(); | ||
|
|
||
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.
why protected?
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.
HoodiePromptunder package has read it.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.
sounds good.