dssysolyatin commented on code in PR #2854:
URL: https://github.com/apache/calcite/pull/2854#discussion_r1141823858


##########
core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java:
##########
@@ -5451,7 +5461,11 @@ ImmutableList<RelNode> retrieveCursors() {
       case CURSOR:
       case IN:
       case NOT_IN:
-        subQuery = requireNonNull(getSubQuery(expr, null));
+        subQuery = getSubQuery(expr, null);
+        if (subQuery == null && (kind == SqlKind.SOME || kind == SqlKind.ALL)) 
{
+          break;
+        }
+        assert subQuery != null;

Review Comment:
   @zoudan @bchapuis  I tend to disagree with you guys. How to distinguish NPE 
in these pieces of code without debugging ?
   ```
   subQuery = null;
   // .... Some code
   requireNonNull(subQuery.expr);
   ```
   
   ```
   subQuery = new SubQuery(node, logic, clause);
   subQuery.expr = null;
   // .... Some code
   requireNonNull(subQuery.expr);
   ```
   
   Both of these snippets result in an NPE with an identical stacktrace. The 
only way to understand what the root cause of the NPE (e.g `subQuery` or 
`subQuery.expr`) is debugging this code. However, getting additional 
information (e.g., queries) for debugging can be hard in a production 
environment due to security concerns. So, It's really important to have as much 
information as possible to understand and fix the problem.



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