Repository navigation
Revert "Add aggregate function gini" - #113868
Conversation
This reverts merge f75ec00 (ClickHouse#112280) in full, restoring all 15 files to their pre-merge content. Besides adding `gini`, that pull request added nine `getArgumentsThatCanBeOnlyNull` overrides across eight combinator files and changed `-If`'s existing one to union the nested set, so a combinator now forwards that set from the function it wraps. The `Null` combinator uses the set to decide whether an argument that can only be NULL folds the whole aggregate into `AggregateFunctionNothing`, so forwarding it removed the fold one level up and changed the result type and value of pre-existing expressions that chain one of those combinators on top of `-If`. A combinator that gained no override keeps the empty set that `IAggregateFunction::getArgumentsThatCanBeOnlyNull` returns by default, so it contributes nothing of its own: `-Merge`, `-Array`, `-ForEach`, `-Tuple` and `-Map` gained none, and `sumIfForEach([number, number], [NULL, NULL])` still returns `Array(UInt64)` `[0, 0]`. Measured on debug builds of this branch and of its parent commit, which contains the merge: `countIfOrNull(number, NULL)` moved from `UInt64` `0` to `Nullable(UInt64)` `NULL`, `sumIfResample(0, 2, 1)(number, NULL, number % 2)` from a scalar `Nullable(Nothing)` to `Array(UInt64)` `[0, 0]`, and `sumIfState(number, NULL)` from a folded `Nothing` to a real `AggregateFunction(sumIf, UInt64, Nullable(Nothing))` state. Those two trees are equivalent to the merge and to its first parent on this surface, by measurement rather than by assumption: for all 15 files the merge touched, the blobs at the parent commit equal the blobs at the merge, and the blobs at this branch's head equal the blobs at f75ec00^1; no file under `src/AggregateFunctions/Combinators/` differs between f75ec00^1 and this head; and of the 46 commits between the merge and this branch's parent, the three that touch `src/AggregateFunctions/` all belong to the unrelated PromQL `deriv` scaling pull request 112360. Four of the new overrides also insert their own column index, and the two outside the `-If` family reach expressions with no `-If` at all, such as `sumArgMin(1, NULL)`. A partial revert is not available. `gini` declares argument 0 in `getArgumentsThatCanBeOnlyNull` itself, and the same forwarding path carries both that declaration and the `-If` filter index, so removing the propagation while keeping `gini` would silently change `gini`'s own combinator results and contradict assertions in its committed test. `gini` is unreleased: the merge is not an ancestor of 26.7, 26.6, 26.5, 26.3 or 25.8, and it never reached `CHANGELOG.md`, so the revert returns 26.8-dev to its pre-merge state without withdrawing released behaviour. A behaviour-neutral re-land of `gini` follows in a separate pull request. Verified by byte identity rather than by a new test: all 15 files hash equal to their `f75ec003a3ee^1` blobs, which is the whole correctness criterion for a revert. Closes: ClickHouse#113763
Internal second-model review: 2 rounds, 3 findings, all fixed before publicationAn independent reviewer read the resulting tree cold, without the author's Round 0 cleared the code and bounced the commit message for two Round 1 found the code and the message clean and corrected three claims in
Independently re-derived this round, with a negative or positive control on each
The second model's final pass returned no findings, having read every changed |
Pre-PR validation (a-i)
Drift was measured against |
|
Workflow [PR], commit [25c2e67] Summary: ✅
AI ReviewSummaryThis PR cleanly reverts the unreleased Final Verdict✅ No review findings in the current head. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 24/26 (92.31%) · Uncovered code |
|
| arm | result |
|---|---|
| delete a docs file with an empty marker pair | FAIL |
| delete a docs file with a non-empty marker pair | FAIL |
| delete a docs file with no markers (control) | PASS |
| edit inside a region, a real violation (control) | FAIL |
| edit outside a region (control) | PASS |
Why keeping the file is not an option. docs/en/ is retired. PR 112141 deleted all 919 files from it, 365 of them carrying a marker pair, and docs/en/ held 0 files immediately before gini merged. 112280 then re-added this single file into the emptied tree. It is also unpublished: docs/_migration/slug-map.csv has 0 rows for docs/en/ and 0 for gini, against 159 rows for aggregate-functions/reference, and 112280 added no slug entry. The generator cannot own it either, since autogenerate_docs.py never references docs/en and drives aggregate pages from docs/reference/functions/aggregate-functions/. Keeping it would leave a doc page for a function that no longer exists, in a tree that was deliberately emptied.
The ask. PR 112141 is the precedent for exactly this operation at 365 times the scale, and it carries pr-autogenerated-docs, applied before merge by the guard's own author. I verified against the real guard body that the label makes this check pass while the read-only-copies half still runs:
| labels | guard result | generated-region half |
|---|---|---|
| none (current) | fail | runs |
pr-autogenerated-docs |
pass | skipped |
| an unrelated label (control) | fail | runs |
I do not have triage permission, so I cannot apply it. Could you add pr-autogenerated-docs here?
The alternative is to teach find_violations that a pure deletion is not an edit inside a region. That is a change to shared CI tooling with its own test, so it belongs in its own PR rather than in a revert, and it is not needed to land this one. I am happy to open it if you would prefer that route.
cc @Manerone
|
Yes please, that is exactly the right unblock. One precision on the cause: it is a pure deletion rather than an edit - the revert removes cc @Manerone |
The revert removed the implementation and the stateless test, but the documentation page reached `master` through a separate migration commit (`2d4afadac21e7b4`, "Docs: move `gini` page to Mintlify") and so arrived on this branch via the master merge rather than through the reverted merge itself. Left in place, `master` would keep publishing a reference page that advertises `gini` as an aggregate function introduced in v26.8.0 while no such function is registered. The page is in the live Mintlify tree, not the retired `docs/en/` tree that an earlier pass over this branch measured, so it is genuinely published: it is reachable from `docs/reference/navigation.json`, its legacy Docusaurus URL is served by an entry in `docs/_site/redirects.json` (added by `56cabc939444e43`), and `docs/_migration/slug-map.csv` maps the old slug onto it. All four artifacts go together; removing only the page would leave a navigation entry and a redirect pointing at a missing target. Regenerating instead of deleting is not an option here. The aggregate family in `autogenerate_docs.py` discovers its work by listing the page directory and carries `skip_if_empty`, so once the function is unregistered the generator neither refreshes nor removes the page; it would dangle indefinitely. v26.8.0 is unreleased, so no published release advertises the function.
Build profile diff (arm_release)Comparing Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Object file sizes
|
| Object file | Master | PR | Δ |
|---|---|---|---|
src/Functions/array/CMakeFiles/clickhouse_functions_array.dir/arrayElement.cpp.o |
7.77 MiB | 7.28 MiB | -508.22 KiB (-6.39%) |
src/Storages/System/CMakeFiles/clickhouse_storages_system.dir/StorageSystemDocumentation.cpp.o |
303.13 KiB | 369.68 KiB | +66.55 KiB (+21.95%) |
src/CMakeFiles/dbms.dir/Processors/Formats/Impl/AvroRowInputFormat.cpp.o |
818.34 KiB | 852.87 KiB | +34.52 KiB (+4.22%) |
src/CMakeFiles/dbms.dir/Storages/MergeTree/ConditionTemplate.cpp.o |
147.29 KiB | 172.69 KiB | +25.40 KiB (+17.25%) |
src/CMakeFiles/dbms.dir/Functions/FunctionsConversion_impl19.cpp.o |
524.35 KiB | 548.98 KiB | +24.62 KiB (+4.70%) |
src/CMakeFiles/dbms.dir/Functions/FunctionsConversion.cpp.o |
20.57 MiB | 20.59 MiB | +24.05 KiB (+0.11%) |
src/CMakeFiles/dbms.dir/Functions/FunctionsConversion_impl17.cpp.o |
782.17 KiB | 804.68 KiB | +22.51 KiB (+2.88%) |
738 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.
Compile time of recompiled translation units
21 translation units recompiled, 126 s compile time in total, 21 of them have a recent master baseline.
CI finish ledger - 25c2e67CI is fully finished on this head with real coverage: 176 check-runs, 0 queued or in progress,
Session id: cron:our-pr-ci-monitor:20260812-213000 |
Re-lands the gini aggregate function that was reverted in ClickHouse#113868, with the three changes @Manerone specified in issue ClickHouse#113763: no getArgumentsThatCanBeOnlyNull override, no returns_default_when_only_null property, and no argument_type->onlyNull() branch in the creator. The property was what made the factory build a real gini instance over Nullable(Nothing) instead of letting AggregateFunctionFactory::getImpl return nullptr, so gini(NULL) produced Float64 nan where every sum-family function folds to Nullable(Nothing). Without the property the fold happens in the Null combinator before any other combinator is applied, and the creator's only-null branch becomes unreachable, which is why createAggregateFunctionSum has no equivalent. Runtime Nullable handling is a separate axis via getOwnNullAdapter and is unchanged: gini over [1, NULL, 3] still returns 0.25. The docs artifacts restore what ClickHouse#113868's wholesale revert removed from @Blargian's merged Mintlify port (ClickHouse#114314): the gini.mdx page plus its slug-map, navigation and redirect entries, taken verbatim from that commit. Reported-by: Manerone
Reverts #112280
Closes: #113763
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Besides adding
gini, #112280 added ninegetArgumentsThatCanBeOnlyNulloverrides across eight combinator files and made-Ifunion the nested set, so those combinators forward that set from the function they wrap.The
Nullcombinator uses that set to decide whether an argument that can only beNULLfolds the aggregate intoAggregateFunctionNothing. Forwarding it removes the fold one level up, so expressions chaining one of them on top of-Ifchanged type and value. Measured on debug builds of this branch and its parent:countIfOrNull(number, NULL)UInt640Nullable(UInt64)NULLsumIfResample(0, 2, 1)(number, NULL, number % 2)Nullable(Nothing)NULLArray(UInt64)[0, 0]sumIfState(number, NULL)Nullable(Nothing)AggregateFunction(sumIf, UInt64, Nullable(Nothing))Two of the new overrides sit outside the
-Iffamily, reaching expressions with no-Ifat all.A partial revert is not available:
ginideclares argument 0 ingetArgumentsThatCanBeOnlyNullitself, and one forwarding path carries both that declaration and the-Iffilter index, so keepingginiwithout the propagation contradicts its own test.giniis unreleased (the merge is not an ancestor of 26.7, 26.6, 26.5, 26.3 or 25.8, and never reachedCHANGELOG.md), so this withdraws no released behaviour. A behaviour-neutral re-land following thesumfamily, as @Manerone specified, comes separately.The docs page is removed here too. It did not come from the reverted merge:
2d4afadac21e7b4moved it into the live Mintlify tree, so it arrived via the master merge. Its navigation entry, legacy redirect and slug-map row go with it, or those would point at a missing target. Regenerating is not an option: the aggregate family inautogenerate_docs.pylists that page directory and carriesskip_if_empty, so an unregistered function's page is never revisited.Verified by byte identity rather than a new test: of the 14 source and test paths the merge touched, 13 match their pre-merge blobs, and
registerAggregateFunctions.cppdiffers only by unrelatedMergedJSONPatchlines master added ine3698631b023165.cc @Manerone
Version info
26.8.1.1317(included in26.8and later)