kgyrtkirk commented on a change in pull request #544: HIVE-16924 Support distinct in presence of Group By URL: https://github.com/apache/hive/pull/544#discussion_r259763434
########## File path: ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java ########## @@ -3730,7 +3697,9 @@ private RelNode genGBLogicalPlan(QB qb, RelNode srcRel) throws SemanticException ASTNode node = (ASTNode) selExprList.getChild(0).getChild(0); if (node.getToken().getType() == HiveParser.TOK_ALLCOLREF) { // As we said before, here we use genSelectLogicalPlan to rewrite AllColRef - srcRel = genSelectLogicalPlan(qb, srcRel, srcRel, null, null, true).getKey(); + if (!(isSelectDistinct(selExprList) && isGroupBy(selExprList))) { Review comment: `isSelectDistinct(selExprList)` is always true here; condition could be changed to `!isGroupBy` I'm not sure if I understand why we would "skip" rewrite `TOK_ALLCOLREF` in case it's not in groupby; I don't think the below statements make sense: ``` create table t (c1 integer,c2 integer); select distinct * from t group by c1; ``` I might be missing something here.. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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 With regards, Apache Git Services