soumyakanti3578 commented on code in PR #5294: URL: https://github.com/apache/hive/pull/5294#discussion_r1678382641
########## 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 see that `tableAlias` is an empty string here, and even in non-cbo path it is an empty string, but not sure if there is a better way to deal with this. I see several instances in the code base where we use empty string for this method. -- 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