rubenada commented on code in PR #2838:
URL: https://github.com/apache/calcite/pull/2838#discussion_r903784005


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -6661,6 +6661,11 @@ static class ExtendedExpander extends Expander {
           SqlIdentifier sid = (SqlIdentifier) expr;
           final SqlIdentifier fqId = getScope().fullyQualify(sid).identifier;
           expr = expandDynamicStar(sid, fqId);
+        } else {
+          requireNonNull(expr, "expr");
+          SqlNode exprCopy = expr.clone(expr.getParserPosition());

Review Comment:
   Thanks for the new commit, I think the latest code with null-check + 
ADVANCED_GROUPING_ELEMENTS is safer.
   Thanks also for the explanation, it's a bit more clear now. Just one 
follow-up question (sorry, I'm not an expert on SqlValidatorImpl), when you say:
   > I make a copy in GROUP expression to make sure the 'empno / 2' type 
couldn't be reused...
   
   How's that, that creating a copy of the SqlNode (and using 
`validator.setOriginal(exprCopy, expr);`) makes the type "non-reusable"?



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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to