jcamachor commented on a change in pull request #612: HIVE-13582: Support for 
Quantified predicates for non-correlated queries
URL: https://github.com/apache/hive/pull/612#discussion_r280642959
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/parse/SubQueryUtils.java
 ##########
 @@ -101,6 +104,67 @@ static ASTNode isNull(ASTNode expr) {
     return node;
   }
 
+  static public void subqueryRestrictionCheck(QB qb, ASTNode subqueryExprNode, 
RelNode srcRel,
+      boolean forHavingClause, Set<ASTNode> corrScalarQueries, Context ctx,
+      LinkedHashMap<RelNode, RowResolver> relToHiveRR)
+      throws SemanticException {
+
+    assert(subqueryExprNode.getType() == HiveParser.TOK_SUBQUERY_EXPR);
+
+    /*
+     * Restriction : Subquery is not allowed in LHS
+     */
+    if (subqueryExprNode.getChildren().size() == 3
+        && subqueryExprNode.getChild(2).getType() == 
HiveParser.TOK_SUBQUERY_EXPR) {
+      throw new 
CalciteSubquerySemanticException(ErrorMsg.UNSUPPORTED_SUBQUERY_EXPRESSION
+          .getMsg(subqueryExprNode.getChild(2), "SubQuery on left hand side is 
not supported."));
+    }
+
+    // avoid subquery restrictions for SOME/ALL for now
+    if(subqueryExprNode.getChild(0).getChildCount() > 1
+        && (subqueryExprNode.getChild(0).getChild(1).getType() == 
HiveParser.KW_SOME
+          || subqueryExprNode.getChild(0).getChild(1).getType() == 
HiveParser.KW_ALL)) {
+      return;
+    }
+
+    // TOK_SUBQUERY_EXPR
+    //  0. TOK_SUBQUERY_OP
+    //     0. TYPE: IN/SOME/EXISTS
+    //     1. Comparion op: >, < etc
+    //  1. TOK_QUERY:   Subquery
+    //  2. LHS expr
+    //final ASTNode clonedSubExprAST = (ASTNode) 
SubQueryUtils.adaptor.dupTree(subqueryExprNode);
+      //we do not care about the transformation or rewriting of AST
 
 Review comment:
   Indentation here seems broken.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to