morningman opened a new pull request, #4628: URL: https://github.com/apache/doris-website/pull/4628
The MIN_BY examples contain tied minimum keys, but display one associated value without explaining how ties are handled. This can suggest that MIN_BY returns the smallest associated value, which the implementation does not guarantee. Document the unspecified choice among tied keys, label existing tied output as one possible result, and add a self-contained query that returns `MIN(k1)` among rows with the minimum `k4`. For the issue's data, this deterministically returns `3`. Fixes #2312. Source checked in master and branches 3.0, 3.1, 4.0, 4.1: `AggregateFunctionMinByData` changes the associated value when the key becomes strictly smaller (`change_if_less` / `set_if_smaller`), including aggregate-state merging. It does not apply `MIN` to the associated value on equal keys. Examples: [3.0 implementation](https://github.com/apache/doris/blob/4090f6c40d2238b7aff73185bcada48f96fbd6be/be/src/vec/aggregate_functions/aggregate_function_min_max_by.h#L130), [master implementation](https://github.com/apache/doris/blob/172120cbaa46b0a2eff6c37d86fb438c3a307375/be/src/exprs/aggregate/aggregate_function_min_max_by.h#L223). ## Review and validation | Checkpoint | Conclusion | | --- | --- | | Goal | Explains tied-key behavior and provides the requested deterministic result. | | Scope | Tie note, output qualification and one standalone example per page. Existing version-specific type behavior retained. | | Versions/locales | Dev, 4.x, 3.x EN/ZH updated together. Archives unchanged. | | Links/navigation | Existing paths, headings, links and sidebar entries retained; one example subheading added. | | Framework | Not affected. | | Validation | Six JSON front-matter blocks parsed; six Markdown pages compiled with the installed MDX compiler; new SQL/output blocks identical across copies; `git diff --check` passed. Independent SQLite evaluation confirms the new query's expected row `(3)`; no Doris SQL execution or full site build was run. | | Other issues | No introduced issue found in self-review. Avoids guaranteeing a first input row or a stable order under distributed aggregation. | ## Versions - [x] dev - [x] 4.x - [x] 3.x - [ ] 2.1 or older ## Languages - [x] Chinese - [x] English ## Docs Checklist - [x] Checked by AI - [ ] Test Cases Built - [x] Updated required version and language counterparts - [x] Updated both languages -- 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]
