ramesh0201 commented on code in PR #5294:
URL: https://github.com/apache/hive/pull/5294#discussion_r1690078807


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java:
##########
@@ -5167,7 +5167,14 @@ private RelNode genGBHavingLogicalPlan(QB qb, RelNode 
srcRel) throws SemanticExc
               UnsupportedFeature.Having_clause_without_any_groupby);
         }
         ASTNode targetNode = (ASTNode) havingClause.getChild(0);
-        validateNoHavingReferenceToAlias(qb, targetNode);
+        QBParseInfo qbPI = qb.getParseInfo();
+        Map<ASTNode, String> exprToAlias = qbPI.getAllExprToColumnAlias();
+        RowResolver inputRR = relToHiveRR.get(srcRel);
+        for (ASTNode astNode : exprToAlias.keySet()) {
+          if (inputRR.getExpression(astNode) != null) {
+            inputRR.put("", exprToAlias.get(astNode), 
inputRR.getExpression(astNode));

Review Comment:
   I agree with you. I think the better way to handle is to pass the tableAlias 
field instead of the "" and then let the field fallback to the empty string if 
it is empty. Given that it is a much broader scope than this PR, I would prefer 
to address this issue separately. Let me know what you think?



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to