Vamsi-klu opened a new pull request, #58038:
URL: https://github.com/apache/spark/pull/58038

   ### What changes were proposed in this pull request?
   Spell out that `COUNT(DISTINCT)` / `count_distinct` skips nulls, in 
`docs/sql-ref-null-semantics.md`.
   
   - Add a `count(DISTINCT age)` example next to the existing `count(*)` / 
`count(age)` block. On the `person` table the result is 3 (ages 30, 18, 50).
   - Add a one-liner in the GROUP BY / DISTINCT section: `COUNT(DISTINCT expr)` 
still follows the aggregate rule and does not count null.
   
   No code change. `Count.scala`, `count.sql.out`, and 
`DataFrameAggregateSuite` already treat distinct count as unique non-null 
values. GROUP BY / SELECT DISTINCT still bucket nulls. Those are different 
rules.
   
   ### Why are the changes needed?
   The page already states both rules, and it is easy to mix them up for 
`COUNT(DISTINCT)`. The ticket reporter hit that. Philipp pointed at the SQL 
standard. Nicholas asked to document it on this page. The implementation is 
already correct.
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   ### How was this patch tested?
   Docs only. Mentally executed on the `person` table on that page: distinct 
non-null ages are 30, 18, 50, so the result is 3. I did not run the Jekyll 
build here because Bundler was not available.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Generated-by: Cursor Grok 4.6
   
   Made with [Cursor](https://cursor.com)


-- 
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]

Reply via email to