zhengruifeng opened a new pull request, #39622:
URL: https://github.com/apache/spark/pull/39622
### What changes were proposed in this pull request?
Fix `count(*)` and `count(expr(*))`
### Why are the changes needed?
1, `count(*)` doesn't work:
```
pyspark.sql.connect.client.SparkConnectAnalysisException:
[UNRESOLVED_COLUMN.WITH_SUGGESTION] A column or function parameter with name
`*` cannot be resolved. Did you mean one of the following? [`alphabets`]
Plan: 'Aggregate [unresolvedalias('count('*), None), count(alphabets#32) AS
count(alphabets)#35L]
+- Project [alphabets#30 AS alphabets#32]
+- LocalRelation [alphabets#30]
```
2, `count(expr(*))` outputs different column name and **incorrect** number
```
Failed example:
df.select(count(expr("*")), count(df.alphabets)).show()
Expected:
+--------+----------------+
|count(1)|count(alphabets)|
+--------+----------------+
| 4| 3|
+--------+----------------+
Got:
+----------------+----------------+
|count(alphabets)|count(alphabets)|
+----------------+----------------+
| 3| 3|
+----------------+----------------+
<BLANKLINE>
```
### Does this PR introduce _any_ user-facing change?
yes
### How was this patch tested?
enabled UT and added UT
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]