mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Fix argMin/argMax combinator state
This commit is contained in:
parent
7c63d99625
commit
1c0d104b48
@ -68,9 +68,9 @@ public:
|
|||||||
String getName() const override
|
String getName() const override
|
||||||
{
|
{
|
||||||
if constexpr (isMin)
|
if constexpr (isMin)
|
||||||
return "ArgMin";
|
return nested_function->getName() + "ArgMin";
|
||||||
else
|
else
|
||||||
return "ArgMax";
|
return nested_function->getName() + "ArgMax";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isState() const override { return nested_function->isState(); }
|
bool isState() const override { return nested_function->isState(); }
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
AggregateFunction(sumArgMin, UInt64, UInt64)
|
||||||
|
54
|
||||||
|
0 45
|
||||||
|
1 46
|
||||||
|
2 47
|
||||||
|
3 48
|
||||||
|
4 49
|
||||||
|
5 50
|
||||||
|
6 51
|
||||||
|
7 52
|
||||||
|
8 53
|
||||||
|
9 54
|
22
tests/queries/0_stateless/03127_argMin_combinator_state.sql
Normal file
22
tests/queries/0_stateless/03127_argMin_combinator_state.sql
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
SELECT toTypeName(sumArgMinState(number, number)) FROM numbers(1);
|
||||||
|
SELECT sumArgMinState(number, number) AS a FROM numbers(3) FORMAT Null;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS argmax_comb;
|
||||||
|
CREATE TABLE argmax_comb(
|
||||||
|
id UInt64,
|
||||||
|
state AggregateFunction(avgArgMax, Float64, UInt64)
|
||||||
|
)
|
||||||
|
ENGINE=MergeTree() ORDER BY tuple();
|
||||||
|
INSERT INTO argmax_comb
|
||||||
|
SELECT
|
||||||
|
CAST(number % 10, 'UInt64') AS id,
|
||||||
|
avgArgMaxState(CAST(number, 'Float64'), id)
|
||||||
|
FROM numbers(100)
|
||||||
|
GROUP BY id;
|
||||||
|
SELECT avgArgMaxMerge(state) FROM argmax_comb;
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
avgArgMaxMerge(state)
|
||||||
|
FROM argmax_comb
|
||||||
|
GROUP BY id
|
||||||
|
ORDER BY id ASC;
|
Loading…
Reference in New Issue
Block a user