You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2021/01/06 13:32:55 UTC

[GitHub] [phoenix] virajjasani commented on a change in pull request #1070: PHOENIX-3633 null pointer exception when subsquery for not exists ret…

virajjasani commented on a change in pull request #1070:
URL: https://github.com/apache/phoenix/pull/1070#discussion_r552610534



##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/join/SubqueryIT.java
##########
@@ -528,10 +528,29 @@ public void testExistsSubquery() throws Exception {
             assertEquals(rs.getString(4), "T1");
 
             assertFalse(rs.next());
-            
+
             rs = conn.createStatement().executeQuery("EXPLAIN " + query);
             String plan = QueryUtil.getExplainPlan(rs);
             assertPlansMatch(plans[2], plan);
+
+            //PHOENIX-3633
+            query = "SELECT * FROM " + tableName4 + " o WHERE NOT EXISTS (SELECT 1 FROM " + tableName1 + " i WHERE \"item_id\" = 'does not exist')";
+            statement = conn.prepareStatement(query);
+            statement = conn.prepareStatement(query);

Review comment:
       nit: repeated

##########
File path: phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
##########
@@ -1217,8 +1217,10 @@ public boolean visitEnter(ExistsParseNode node) throws SQLException {
     @Override
     public Expression visitLeave(ExistsParseNode node, List<Expression> l) throws SQLException {
         LiteralExpression child = (LiteralExpression) l.get(0);
-        PhoenixArray array = (PhoenixArray) child.getValue();
-        return LiteralExpression.newConstant(array.getDimensions() > 0 ^ node.isNegate(), PBoolean.INSTANCE);
+        boolean exists = child != null

Review comment:
       nit: could be `elementExists`? It's upto you.




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