abstractdog commented on code in PR #5916:
URL: https://github.com/apache/hive/pull/5916#discussion_r2177522194


##########
itests/hive-unit/src/test/java/org/apache/hive/beeline/TestHplSqlViaBeeLine.java:
##########
@@ -1052,17 +1052,22 @@ public void testHplSqlContinueConditionHandler() throws 
Throwable {
   @Test
   public void testHplSqlExitConditionHandler() throws Throwable {
     String scriptText =
-        "CREATE PROCEDURE p1()\n" +
+        "DROP TABLE IF EXISTS result;\n" +
+            "CREATE TABLE result (s string);\n" +
+            "CREATE PROCEDURE p1()\n" +
             "BEGIN\n" +
-            " PRINT('Exit CONDITION Handler invoked.');\n" +
+            " INSERT INTO result VALUES('Exit CONDITION Handler invoked.');\n" 
+
             "END;\n" +
-            "DECLARE cnt_condition CONDITION;\n" +
-            "DECLARE EXIT HANDLER FOR cnt_condition\n" +
-            " p1();\n" +
-            "IF 1 <> 2 THEN\n" +
-            " SIGNAL cnt_condition;\n" +
-            "END IF;";
-    testScriptFile(scriptText, args(), "Exit CONDITION Handler invoked.", 
OutStream.ERR);
+            "CREATE PROCEDURE p2()" +
+            "BEGIN\n" +
+            " DECLARE exit_condition CONDITION;\n" +
+            " DECLARE EXIT HANDLER FOR exit_condition\n" +
+            "   p1();\n" +
+            " SIGNAL exit_condition;\n" +
+            "END;\n" +
+            "p2();" +

Review Comment:
   can you please exaplain here for future clarity why the original testcase 
was invalid?
   I'm not familiar with hplsql, so this makes me think that these statements 
somehow didn't trigger the exit condition:
   ```
               "IF 1 <> 2 THEN\n" +
               " SIGNAL cnt_condition;\n" +
   ```
   
   also PRINT has been changed to INSERT INTO: isn't a PRINT sufficient to this 
this hplsql feature and demonstrate that p1() has been called as an EXIT 
HANDLER?
   
   



##########
itests/hive-unit/src/test/java/org/apache/hive/beeline/TestHplSqlViaBeeLine.java:
##########
@@ -1052,17 +1052,22 @@ public void testHplSqlContinueConditionHandler() throws 
Throwable {
   @Test
   public void testHplSqlExitConditionHandler() throws Throwable {
     String scriptText =
-        "CREATE PROCEDURE p1()\n" +
+        "DROP TABLE IF EXISTS result;\n" +
+            "CREATE TABLE result (s string);\n" +
+            "CREATE PROCEDURE p1()\n" +
             "BEGIN\n" +
-            " PRINT('Exit CONDITION Handler invoked.');\n" +
+            " INSERT INTO result VALUES('Exit CONDITION Handler invoked.');\n" 
+
             "END;\n" +
-            "DECLARE cnt_condition CONDITION;\n" +
-            "DECLARE EXIT HANDLER FOR cnt_condition\n" +
-            " p1();\n" +
-            "IF 1 <> 2 THEN\n" +
-            " SIGNAL cnt_condition;\n" +
-            "END IF;";
-    testScriptFile(scriptText, args(), "Exit CONDITION Handler invoked.", 
OutStream.ERR);
+            "CREATE PROCEDURE p2()" +
+            "BEGIN\n" +
+            " DECLARE exit_condition CONDITION;\n" +
+            " DECLARE EXIT HANDLER FOR exit_condition\n" +
+            "   p1();\n" +
+            " SIGNAL exit_condition;\n" +
+            "END;\n" +
+            "p2();" +

Review Comment:
   can you please exaplain here for future clarity why the original testcase 
was invalid?
   I'm not familiar with hplsql, so this makes me think that these statements 
somehow didn't trigger the exit condition:
   ```
               "IF 1 <> 2 THEN\n" +
               " SIGNAL cnt_condition;\n" +
   ```
   
   also PRINT has been changed to INSERT INTO: isn't a PRINT sufficient to 
demonstrate this hplsql feature and demonstrate that p1() has been called as an 
EXIT HANDLER?
   
   



-- 
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: gitbox-unsubscr...@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to