You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "Abyss-lord (via GitHub)" <gi...@apache.org> on 2025/01/03 09:13:44 UTC

[PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Abyss-lord opened a new pull request, #6091:
URL: https://github.com/apache/gravitino/pull/6091

   ### What changes were proposed in this pull request?
   
   Add verify method to Command, and refactor the validation code.
   
   ### Why are the changes needed?
   
   Fix: #6086 
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   #### UT
   
   local ut
   
   #### bash
   
   ```bash
   gcli metalake set
   # Missing --metalake option.
   
   gcli metalake details
   # Missing --metalake option.
   
   gcli metalake set -m demo_metalake
   # Missing --property and --value options.
   
   gcli metalake set -m demo_metalake --property propertyA
   # Missing --value option.
   
   gcli metalake set -m demo_metalake --value valA
   # Missing --property option.
   
   gcli metalake details --audit
   # Missing --metalake option.
   ```


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1903184868


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -221,21 +218,26 @@ private void handleMetalakeCommand() {
         }
         if (line.hasOption(GravitinoOptions.ENABLE)) {
           boolean enableAllCatalogs = line.hasOption(GravitinoOptions.ALL);
-          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).handle();
+          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).validate().handle();
+          break;

Review Comment:
   Yes



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1902211102


##########
clients/cli/src/main/java/org/apache/gravitino/cli/commands/Command.java:
##########
@@ -99,6 +100,16 @@ public static void setAuthenticationMode(String authentication, String userName)
 
   /** All commands have a handle method to handle and run the required command. */
   public abstract void handle();
+
+  /**
+   * verify the arguments. All commands have a verify method to verify the arguments.
+   *
+   * @return Returns itself via argument validation, otherwise exits.
+   */
+  public Command verify() {

Review Comment:
   I agree validate is probably a better name.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1903160062


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -221,21 +218,26 @@ private void handleMetalakeCommand() {
         }
         if (line.hasOption(GravitinoOptions.ENABLE)) {
           boolean enableAllCatalogs = line.hasOption(GravitinoOptions.ALL);
-          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).handle();
+          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).validate().handle();
+          break;

Review Comment:
   Sorry but this command should not have the added breaks here and below, so it is possible to update more than one thing at once.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1902519010


##########
clients/cli/src/test/java/org/apache/gravitino/cli/TestFulllName.java:
##########
@@ -224,16 +224,4 @@ public void testGetMetalake() throws ParseException {
     String metalakeName = fullName.getMetalakeName();
     assertEquals(metalakeName, "demo_metalake");
   }
-
-  @Test
-  @SuppressWarnings("DefaultCharset")
-  public void testGetMetalakeWithoutMetalakeOption() throws ParseException {
-    String[] args = {"table", "list", "-i", "--name", "Hive_catalog.default"};
-    CommandLine commandLine = new DefaultParser().parse(options, args);
-    FullName fullName = new FullName(commandLine);
-    String metalakeName = fullName.getMetalakeName();
-    assertNull(metalakeName);
-    String errOutput = new String(errContent.toByteArray(), StandardCharsets.UTF_8).trim();
-    assertEquals(errOutput, ErrorMessages.MISSING_METALAKE);
-  }

Review Comment:
   @justinmclean , This test case is redundant with Test entityNotFound.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#issuecomment-2568949034

   Hi @justinmclean @tengqm , could you please review this PR when you have time? I’d really appreciate your feedback.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1902887870


##########
clients/cli/src/test/java/org/apache/gravitino/cli/TestFulllName.java:
##########
@@ -224,16 +224,4 @@ public void testGetMetalake() throws ParseException {
     String metalakeName = fullName.getMetalakeName();
     assertEquals(metalakeName, "demo_metalake");
   }
-
-  @Test
-  @SuppressWarnings("DefaultCharset")
-  public void testGetMetalakeWithoutMetalakeOption() throws ParseException {
-    String[] args = {"table", "list", "-i", "--name", "Hive_catalog.default"};
-    CommandLine commandLine = new DefaultParser().parse(options, args);
-    FullName fullName = new FullName(commandLine);
-    String metalakeName = fullName.getMetalakeName();
-    assertNull(metalakeName);
-    String errOutput = new String(errContent.toByteArray(), StandardCharsets.UTF_8).trim();
-    assertEquals(errOutput, ErrorMessages.MISSING_METALAKE);
-  }

Review Comment:
   the test is testing a little more than `entityNotFount` as the entity is specified.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1902166723


##########
clients/cli/src/main/java/org/apache/gravitino/cli/commands/RemoveMetalakeProperty.java:
##########
@@ -60,4 +60,11 @@ public void handle() {
 
     System.out.println(property + " property removed.");
   }
+
+  @Override
+  public Command verify() {
+    if (metalake == null) exitWithError(ErrorMessages.MISSING_METALAKE);
+    if (property == null) exitWithError(ErrorMessages.MISSING_PROPERTY);
+    return this;
+  }

Review Comment:
   Again there should be no need to duplicate parts of other verify methods.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1903160062


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -221,21 +218,26 @@ private void handleMetalakeCommand() {
         }
         if (line.hasOption(GravitinoOptions.ENABLE)) {
           boolean enableAllCatalogs = line.hasOption(GravitinoOptions.ALL);
-          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).handle();
+          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).validate().handle();
+          break;

Review Comment:
   Sorry but this command should not have the added breaks here and below, so if possible to update more than one thing at once.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1902166723


##########
clients/cli/src/main/java/org/apache/gravitino/cli/commands/RemoveMetalakeProperty.java:
##########
@@ -60,4 +60,11 @@ public void handle() {
 
     System.out.println(property + " property removed.");
   }
+
+  @Override
+  public Command verify() {
+    if (metalake == null) exitWithError(ErrorMessages.MISSING_METALAKE);
+    if (property == null) exitWithError(ErrorMessages.MISSING_PROPERTY);
+    return this;
+  }

Review Comment:
   Again there should be no need to duplicate part of other verify methods.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1902416081


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -221,21 +218,28 @@ private void handleMetalakeCommand() {
         }
         if (line.hasOption(GravitinoOptions.ENABLE)) {
           boolean enableAllCatalogs = line.hasOption(GravitinoOptions.ALL);
-          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).handle();
+          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).validate().handle();
+          break;
         }
         if (line.hasOption(GravitinoOptions.DISABLE)) {
-          newMetalakeDisable(url, ignore, metalake).handle();
+          newMetalakeDisable(url, ignore, metalake).validate().handle();
+          break;
         }
 
         if (line.hasOption(GravitinoOptions.COMMENT)) {
           comment = line.getOptionValue(GravitinoOptions.COMMENT);
-          newUpdateMetalakeComment(url, ignore, metalake, comment).handle();
+          newUpdateMetalakeComment(url, ignore, metalake, comment).validate().handle();
+          break;
         }
         if (line.hasOption(GravitinoOptions.RENAME)) {
           String newName = line.getOptionValue(GravitinoOptions.RENAME);
           force = line.hasOption(GravitinoOptions.FORCE);
-          newUpdateMetalakeName(url, ignore, force, metalake, newName).handle();
+          newUpdateMetalakeName(url, ignore, force, metalake, newName).validate().handle();
+          break;
         }
+
+        System.err.println("The command does nothing.");
+        Main.exit(-1);

Review Comment:
   I'm not sure we should add this, while it could be a mistake, it could also be intentional if scripted. I'm leaning towards not having these two lines.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1902890860


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -221,21 +218,28 @@ private void handleMetalakeCommand() {
         }
         if (line.hasOption(GravitinoOptions.ENABLE)) {
           boolean enableAllCatalogs = line.hasOption(GravitinoOptions.ALL);
-          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).handle();
+          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).validate().handle();
+          break;
         }
         if (line.hasOption(GravitinoOptions.DISABLE)) {
-          newMetalakeDisable(url, ignore, metalake).handle();
+          newMetalakeDisable(url, ignore, metalake).validate().handle();
+          break;
         }
 
         if (line.hasOption(GravitinoOptions.COMMENT)) {
           comment = line.getOptionValue(GravitinoOptions.COMMENT);
-          newUpdateMetalakeComment(url, ignore, metalake, comment).handle();
+          newUpdateMetalakeComment(url, ignore, metalake, comment).validate().handle();
+          break;
         }
         if (line.hasOption(GravitinoOptions.RENAME)) {
           String newName = line.getOptionValue(GravitinoOptions.RENAME);
           force = line.hasOption(GravitinoOptions.FORCE);
-          newUpdateMetalakeName(url, ignore, force, metalake, newName).handle();
+          newUpdateMetalakeName(url, ignore, force, metalake, newName).validate().handle();
+          break;
         }
+
+        System.err.println("The command does nothing.");
+        Main.exit(-1);

Review Comment:
   You are doing more than just informing the user it will exit with -1, which indicates an error when it may not be one.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1903301025


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -221,21 +218,26 @@ private void handleMetalakeCommand() {
         }
         if (line.hasOption(GravitinoOptions.ENABLE)) {
           boolean enableAllCatalogs = line.hasOption(GravitinoOptions.ALL);
-          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).handle();
+          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).validate().handle();
+          break;

Review Comment:
   @justinmclean fix



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1902523207


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -221,21 +218,28 @@ private void handleMetalakeCommand() {
         }
         if (line.hasOption(GravitinoOptions.ENABLE)) {
           boolean enableAllCatalogs = line.hasOption(GravitinoOptions.ALL);
-          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).handle();
+          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).validate().handle();
+          break;
         }
         if (line.hasOption(GravitinoOptions.DISABLE)) {
-          newMetalakeDisable(url, ignore, metalake).handle();
+          newMetalakeDisable(url, ignore, metalake).validate().handle();
+          break;
         }
 
         if (line.hasOption(GravitinoOptions.COMMENT)) {
           comment = line.getOptionValue(GravitinoOptions.COMMENT);
-          newUpdateMetalakeComment(url, ignore, metalake, comment).handle();
+          newUpdateMetalakeComment(url, ignore, metalake, comment).validate().handle();
+          break;
         }
         if (line.hasOption(GravitinoOptions.RENAME)) {
           String newName = line.getOptionValue(GravitinoOptions.RENAME);
           force = line.hasOption(GravitinoOptions.FORCE);
-          newUpdateMetalakeName(url, ignore, force, metalake, newName).handle();
+          newUpdateMetalakeName(url, ignore, force, metalake, newName).validate().handle();
+          break;
         }
+
+        System.err.println("The command does nothing.");
+        Main.exit(-1);

Review Comment:
   @justinmclean , hi Justin, Whether the user should be prompted if no action is taken?
   



##########
clients/cli/src/test/java/org/apache/gravitino/cli/TestFulllName.java:
##########
@@ -224,16 +224,4 @@ public void testGetMetalake() throws ParseException {
     String metalakeName = fullName.getMetalakeName();
     assertEquals(metalakeName, "demo_metalake");
   }
-
-  @Test
-  @SuppressWarnings("DefaultCharset")
-  public void testGetMetalakeWithoutMetalakeOption() throws ParseException {
-    String[] args = {"table", "list", "-i", "--name", "Hive_catalog.default"};
-    CommandLine commandLine = new DefaultParser().parse(options, args);
-    FullName fullName = new FullName(commandLine);
-    String metalakeName = fullName.getMetalakeName();
-    assertNull(metalakeName);
-    String errOutput = new String(errContent.toByteArray(), StandardCharsets.UTF_8).trim();
-    assertEquals(errOutput, ErrorMessages.MISSING_METALAKE);
-  }

Review Comment:
   @justinmclean , This test case is redundant with Test `entityNotFound`.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1902443521


##########
clients/cli/src/test/java/org/apache/gravitino/cli/TestFulllName.java:
##########
@@ -224,16 +224,4 @@ public void testGetMetalake() throws ParseException {
     String metalakeName = fullName.getMetalakeName();
     assertEquals(metalakeName, "demo_metalake");
   }
-
-  @Test
-  @SuppressWarnings("DefaultCharset")
-  public void testGetMetalakeWithoutMetalakeOption() throws ParseException {
-    String[] args = {"table", "list", "-i", "--name", "Hive_catalog.default"};
-    CommandLine commandLine = new DefaultParser().parse(options, args);
-    FullName fullName = new FullName(commandLine);
-    String metalakeName = fullName.getMetalakeName();
-    assertNull(metalakeName);
-    String errOutput = new String(errContent.toByteArray(), StandardCharsets.UTF_8).trim();
-    assertEquals(errOutput, ErrorMessages.MISSING_METALAKE);
-  }

Review Comment:
   Why was this test removed?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#issuecomment-2570155213

   @justinmclean , I’ve finished updating the code. Please take a look at the PR again when you have time.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "tengqm (via GitHub)" <gi...@apache.org>.
tengqm commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1901682485


##########
clients/cli/src/main/java/org/apache/gravitino/cli/commands/Command.java:
##########
@@ -99,6 +100,16 @@ public static void setAuthenticationMode(String authentication, String userName)
 
   /** All commands have a handle method to handle and run the required command. */
   public abstract void handle();
+
+  /**
+   * verify the arguments. All commands have a verify method to verify the arguments.
+   *
+   * @return Returns itself via argument validation, otherwise exits.
+   */
+  public Command verify() {

Review Comment:
   I'd call this `validate` rather than `verify`.
   `verify`, to me, is an action to confirm that something happened.
   



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1902166036


##########
clients/cli/src/main/java/org/apache/gravitino/cli/commands/MetalakeEnable.java:
##########
@@ -69,4 +69,10 @@ public void handle() {
 
     System.out.println(msgBuilder);
   }
+
+  @Override
+  public Command verify() {
+    if (metalake == null) exitWithError(ErrorMessages.MISSING_METALAKE);
+    return super.verify();
+  }

Review Comment:
   You don't need to duplicate this method several times. Also check if it is actually needed, as we don't want to duplicate work the CLI or other code does.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1903181473


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -221,21 +218,26 @@ private void handleMetalakeCommand() {
         }
         if (line.hasOption(GravitinoOptions.ENABLE)) {
           boolean enableAllCatalogs = line.hasOption(GravitinoOptions.ALL);
-          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).handle();
+          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).validate().handle();
+          break;

Review Comment:
   @justinmclean , so a single update command can perform multiple update operations?
   



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#issuecomment-2571251961

   @justinmclean I’ve finished updating the code. Please take a look at the PR again when you have time.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on code in PR #6091:
URL: https://github.com/apache/gravitino/pull/6091#discussion_r1903301025


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -221,21 +218,26 @@ private void handleMetalakeCommand() {
         }
         if (line.hasOption(GravitinoOptions.ENABLE)) {
           boolean enableAllCatalogs = line.hasOption(GravitinoOptions.ALL);
-          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).handle();
+          newMetalakeEnable(url, ignore, metalake, enableAllCatalogs).validate().handle();
+          break;

Review Comment:
   @justinmclean I fix the code.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#6086] fix(CLI): Refactor the validation logic of Metalake [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean merged PR #6091:
URL: https://github.com/apache/gravitino/pull/6091


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org