my7ym commented on a change in pull request #1186: [CALCITE-3003]
AssertionError when GROUP BY nested field
URL: https://github.com/apache/calcite/pull/1186#discussion_r279203643
##########
File path:
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorUtil.java
##########
@@ -836,7 +836,7 @@ private static ImmutableBitSet
analyzeGroupExpr(SqlValidatorScope scope,
SqlIdentifier expr = (SqlIdentifier) expandedGroupExpr;
// column references should be fully qualified.
- assert expr.names.size() == 2;
+ assert expr.names.size() >= 2;
String originalRelName = expr.names.get(0);
String originalFieldName = expr.names.get(1);
Review comment:
Thanks @chunweilei for such a responsive review!
I considered it and did a research on it but decided not to do it. The
reason is that
1. The validation is already there in this function:
https://github.com/apache/calcite/blob/9bce62c6b6abd13d551d0eed1f1e14b024bbb2ae/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorUtil.java#L843-L850
2. And most importantly, a better validatio is already done here:
https://github.com/apache/calcite/blob/9bce62c6b6abd13d551d0eed1f1e14b024bbb2ae/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3946
Sorry that I should've included those reasons here.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services