AngersZhuuuu commented on a change in pull request #32089:
URL: https://github.com/apache/spark/pull/32089#discussion_r611111481
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala
##########
@@ -268,6 +268,15 @@ private[spark] object QueryCompilationErrors {
s"(valid range is [1, $size])", t.origin.line, t.origin.startPosition)
}
+ def groupByPositionRefersToAggregateFunctionError(
+ index: Int,
+ expr: Expression,
+ t: TreeNode[_]): Throwable = {
+ new AnalysisException(s"GROUP BY $index refers to an expression that is or
contains " +
+ "an aggregate function. Aggregate functions are not allowed in GROUP BY,
" +
+ s"but got ${expr.sql}", t.origin.line, t.origin.startPosition)
Review comment:
> Instead of using `t.origin.line` and `t.origin.startPosition`, we can
wrap the code with `withPosition` so we can remove `t` here (see comment in
Anayzer).
Nice suggestion, thanks
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]