[ https://issues.apache.org/jira/browse/SPARK-51820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17945259#comment-17945259 ]
Mihailo Timotic commented on SPARK-51820: ----------------------------------------- Tests to be added back after we align single-pass analyzer with this fix: {code:java} test("Valid group by ordinal") { val resolverRunner = createResolverRunner() val query = table.groupBy(intToLiteral(1))(intToLiteral(1)) resolverRunner.resolve(query) }{code} {code:java} test("Group by ordinal which refers to aggregate function") { val resolverRunner = createResolverRunner() val query = table.groupBy(intToLiteral(1))($"count".function(intToLiteral(1))) checkError( exception = intercept[AnalysisException] { resolverRunner.resolve(query) }, condition = "GROUP_BY_POS_AGGREGATE", parameters = Map("index" -> "1", "aggExpr" -> $"count".function(intToLiteral(1)).as("count(1)").sql) ) } {code} {code:java} test("Group by ordinal out of range") { val resolverRunner = createResolverRunner() val query = table.groupBy(intToLiteral(100))(intToLiteral(1)) checkError( exception = intercept[AnalysisException] { resolverRunner.resolve(query) }, condition = "GROUP_BY_POS_OUT_OF_RANGE", parameters = Map("index" -> "100", "size" -> "1") ) } {code} {code:java} test("Group by ordinal with a star in the aggregate expression list") { val resolverRunner = createResolverRunner() val query = table.groupBy(intToLiteral(1))(star()) checkError( exception = intercept[AnalysisException] { resolverRunner.resolve(query) }, condition = "STAR_GROUP_BY_POS", parameters = Map.empty ) } {code} > Move `UnresolvedOrdinal` construction before analysis to avoid issue with > group by ordinal > ------------------------------------------------------------------------------------------ > > Key: SPARK-51820 > URL: https://issues.apache.org/jira/browse/SPARK-51820 > Project: Spark > Issue Type: Improvement > Components: SQL > Affects Versions: 4.0.0, 4.1.0 > Reporter: Mihailo Timotic > Priority: Major > Labels: pull-request-available > > Move `UnresolvedOrdinal` construction before analysis to avoid issue with > group by ordinal when doing repeated analysis. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org