#pragma once #include #include #include #include namespace DB { /** PartUUIDs is a uuid set to control query deduplication. * The object is used in query context in both direction: * Server->Client to send all parts' UUIDs that have been read during the query * Client->Server to ignored specified parts from being processed. * * Current implementation assumes a user setting allow_experimental_query_deduplication=1 is set. */ struct PartUUIDs { public: /// Add new UUIDs if not duplicates found otherwise return duplicated UUIDs std::vector add(const std::vector & uuids); /// Get accumulated UUIDs std::vector get() const; bool has(const UUID & uuid) const; private: mutable std::mutex mutex; std::unordered_set uuids; }; using PartUUIDsPtr = std::shared_ptr; }