v.20.1Improvement
Fix Column Already Exists Error with FINAL and SAMPLE in ClickHouse
Fix errorColumn ... already existswhile usingFINALandSAMPLEtogether, e.g.select count() from table final sample 1/2. Fixes #5186. #7907 (Nikolai Kochetov)
Why it matters
This fix addresses the conflict that caused duplicate column errors when combining theFINAL modifier with SAMPLE clauses in queries. It ensures that users can safely perform sampling on finalized data parts without encountering errors, improving query reliability and usability.How to use it
Simply use theFINAL modifier together with the SAMPLE clause in your query as usual. For example:SELECT count() FROM table FINAL SAMPLE 1/2This fix removes the previous limitation where such queries would fail due to column duplication errors.