mihaibudiu commented on code in PR #3588:
URL: https://github.com/apache/calcite/pull/3588#discussion_r1467100622


##########
testkit/src/main/java/org/apache/calcite/sql/test/SqlTests.java:
##########
@@ -265,6 +265,20 @@ public static void checkEx(@Nullable Throwable ex,
       }
     }
 
+    // Search for an IllegalStateException somewhere in the stack.
+    // These are thrown by the enumerable implementors when evaluating
+    // an expression that produces an error.
+    IllegalStateException ise = null;
+    for (Throwable x = ex; x != null; x = x.getCause()) {
+      if (x instanceof IllegalStateException) {
+        ise = (IllegalStateException) x;
+        break;
+      }
+      if (x.getCause() == x) {

Review Comment:
   I have seen this pattern used elsewhere in this function, so I have followed 
it. I am not sure whether a Throwable can have itself as a cause. It looks like 
the Java APIs make that possible, since you can create a Throwable and assign a 
cause to it later using initCause.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to