[ https://issues.apache.org/jira/browse/HIVE-13582?focusedWorklogId=237253&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-237253 ]
ASF GitHub Bot logged work on HIVE-13582: ----------------------------------------- Author: ASF GitHub Bot Created on: 04/May/19 21:36 Start Date: 04/May/19 21:36 Worklog Time Spent: 10m Work Description: vineetgarg02 commented on pull request #612: HIVE-13582: Support for Quantified predicates for non-correlated queries URL: https://github.com/apache/hive/pull/612#discussion_r280996152 ########## 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: Will fix it. ---------------------------------------------------------------- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 237253) Time Spent: 1.5h (was: 1h 20m) > E061-07 and E061-12: Quantified Comparison Predicates > ----------------------------------------------------- > > Key: HIVE-13582 > URL: https://issues.apache.org/jira/browse/HIVE-13582 > Project: Hive > Issue Type: Sub-task > Reporter: Carter Shanklin > Assignee: Vineet Garg > Priority: Major > Labels: pull-request-available > Attachments: HIVE-13582.1.patch, HIVE-13582.2.patch, > HIVE-13582.3.patch, HIVE-13582.4.patch > > Time Spent: 1.5h > Remaining Estimate: 0h > > This is a part of the SQL:2011 Analytics Complete Umbrella JIRA HIVE-13554. > Quantified comparison predicates (ANY/SOME/ALL) are mandatory in the SQL > standard. Hive should support the predicates (E061-07) and you should be able > to use these with subqueries (E061-12) -- This message was sent by Atlassian JIRA (v7.6.3#76005)