Commit Graph

2 Commits

Author SHA1 Message Date
Azat Khuzhin
f1aebbe927 Check that totals correctly calculated in 01865_aggregator_overflow_row
Change aggregation function to uniqCombined() to check this.
2021-05-08 20:43:01 +03:00
Azat Khuzhin
4cecc238d6 Fix SIGSEGV for external GROUP BY and overflow row
Overflow row is used for GROUP BY if all of the above is true:
- WITH TOTALS is requested
- max_rows_to_group_by > 0
- group_by_overflow_mode = any
- totals_mode != after_having_exclusive

And in case of overflow row and external GROUP BY, once the temporary
file dumps to disk it resets without_key data variant to nullptr, so any
subsequent dump to disk will cause SIGSEGV.

Fix this, by recreating without_key data variant after dumping to disk,
instead of reseting to nullptr.

And also add sanity check (LOGICAL_ERROR) to make error more
deterministic in case of such error.

Found with fuzzer [1].

  [1]: https://clickhouse-test-reports.s3.yandex.net/23929/e7027e052998540ee660d186727e20f9555b729d/fuzzer_ubsan/report.html#fail1
2021-05-08 17:48:24 +03:00