Skip to content

Discrepancy. SummingMergeTree sums partition key but does't update min_max #7867

@den-crane

Description

@den-crane

It was kinda unexpected that SummingMergeTree sums partition key columns.

Probably CH have to forbid such schema on create table and raise an error.
Or exclude partition key columns from sum list.

CREATE TABLE tt
( a   Int64, d   Int64, val Int64 ) 
ENGINE = SummingMergeTree PARTITION BY (a) ORDER BY (d);

insert into tt select number%13, number%17, 1 from numbers(1000000);

optimize table tt final;

select a, count() from tt group by a;
┌─────a─┬─count()─┐
│     0 │      17 │
│ 40725 │      15 │
│ 18096 │       2 │
│ 45240 │       2 │
│ 13572 │       2 │
│ 49775 │      15 │
│ 54288 │       2 │
│ 31668 │       2 │
│ 40716 │       2 │
│  4524 │       2 │
│ 36192 │       2 │
│ 18100 │      15 │
│ 13575 │      15 │
│  4525 │      15 │
│ 22625 │      15 │
│ 45250 │      15 │
│  9050 │      15 │
│ 27150 │      15 │
│ 54300 │      15 │
│ 27144 │       2 │
│ 49764 │       2 │
│ 36200 │      15 │
│ 22620 │       2 │
│  9048 │       2 │
│ 31675 │      15 │
└───────┴─────────┘


select * from tt where a>13;
Ok.

0 rows in set. Elapsed: 0.001 sec.

Metadata

Metadata

Labels

bugConfirmed user-visible misbehaviour in official releasest-acceptedThe issue is in our backlog, ready to take

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions