You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2019/12/21 23:26:24 UTC

[GitHub] [incubator-hudi] leesf commented on a change in pull request #1110: [HUDI-416] improve hint information for cli

leesf commented on a change in pull request #1110: [HUDI-416] improve hint information for cli
URL: https://github.com/apache/incubator-hudi/pull/1110#discussion_r360672783
 
 

 ##########
 File path: hudi-cli/src/main/java/org/apache/hudi/cli/commands/CompactionCommand.java
 ##########
 @@ -71,10 +72,12 @@
 
   private static final String TMP_DIR = "/tmp/";
 
-  @CliAvailabilityIndicator({"compactions show all", "compaction show", "compaction run", "compaction schedule"})
-  public boolean isAvailable() {
-    return (HoodieCLI.tableMetadata != null)
-        && (HoodieCLI.tableMetadata.getTableType() == HoodieTableType.MERGE_ON_READ);
+  private HoodieTableMetaClient checkAndGetMetaClient() {
+    HoodieTableMetaClient client = HoodieCLI.getTableMetaClient();
+    if (client.getTableType() != HoodieTableType.MERGE_ON_READ) {
+      throw new InvalidTableTypeException("Compactions can only be run for table type : MERGE_ON_READ");
 
 Review comment:
   How about using `HoodieException` here and avoid creating new InvalidTableTypeException class since it is only used here currently?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services