mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 17:20:50 +00:00
test for Decimal aggregateFunction normalization #39420
This commit is contained in:
parent
0dc183921f
commit
1bf98f4171
@ -0,0 +1,3 @@
|
||||
1.100001
|
||||
0.000001
|
||||
19 0.1
|
@ -0,0 +1,62 @@
|
||||
select sumMerge(y) from
|
||||
(
|
||||
select cast(x, 'AggregateFunction(sum, Decimal(50, 10))') y from
|
||||
(
|
||||
select arrayReduce('sumState', [toDecimal256('0.000001', 10), toDecimal256('1.1', 10)]) x
|
||||
)
|
||||
);
|
||||
|
||||
select minMerge(y) from
|
||||
(
|
||||
select cast(x, 'AggregateFunction(min, Decimal(18, 10))') y from
|
||||
(
|
||||
select arrayReduce('minState', [toDecimal64('0.000001', 10), toDecimal64('1.1', 10)]) x
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
drop table if exists consumer_02366;
|
||||
drop table if exists producer_02366;
|
||||
drop table if exists mv_02366;
|
||||
|
||||
CREATE TABLE consumer_02366
|
||||
(
|
||||
`id` UInt16,
|
||||
`dec` AggregateFunction(argMin, Decimal(24, 10), UInt16)
|
||||
)
|
||||
ENGINE = AggregatingMergeTree
|
||||
PRIMARY KEY id
|
||||
ORDER BY id;
|
||||
|
||||
CREATE TABLE producer_02366
|
||||
(
|
||||
`id` UInt16,
|
||||
`dec` String
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
PRIMARY KEY id
|
||||
ORDER BY id;
|
||||
|
||||
CREATE MATERIALIZED VIEW mv_02366 TO consumer_02366 AS
|
||||
SELECT
|
||||
id,
|
||||
argMinState(dec, id) AS dec
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
id,
|
||||
toDecimal128(dec, 10) AS dec
|
||||
FROM producer_02366
|
||||
)
|
||||
GROUP BY id;
|
||||
|
||||
INSERT INTO producer_02366 (*) VALUES (19, '.1');
|
||||
|
||||
SELECT
|
||||
id,
|
||||
finalizeAggregation(dec)
|
||||
FROM consumer_02366;
|
||||
|
||||
drop table consumer_02366;
|
||||
drop table producer_02366;
|
||||
drop table mv_02366;
|
Loading…
Reference in New Issue
Block a user