The problem is that findOrPromiseToBuild() can also call
shared_future::get():
(lldb) bt 10
* thread 194, name = 'MergeMutate', stop reason = step over
* frame 0: 0x0000564126046bd2 clickhouse`std::rethrow_exception(p=(__ptr_ = 0x00007b5000130c80)) at exception_pointer_cxxabi.ipp:68:39
frame 1: 0x000056411c4c5ddd clickhouse`std::__1::__assoc_state<std::__1::shared_ptr<DB::Set>>::copy(this=<unavailable>) at future:701:9
frame 2: 0x000056411c4c0e3f clickhouse`DB::PreparedSetsCache::findOrPromiseToBuild(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) [inlined] std::__1::shared_future<std::__1::shared_ptr<DB::Set>>::get[abi:v15000](this=0x00007b0c00154eb8) const at future:2243:46
frame 3: 0x000056411c4c0e2e clickhouse`DB::PreparedSetsCache::findOrPromiseToBuild(this=0x00007b1c00077018, key="__set_10438532338982543705_15680061365857338647") at PreparedSets.cpp:349:116
Note, that my test did not find the problem because of #55261 had not
been merged yet.
Follow-up for: #55338Fixes: #55279
v2: s/createDeprecated/createRuntime/
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
Since current getting schema for CapnProto doesn't use cache, the
integration test was for the future if someone add cache.
Also, I was curious how schema cache affects performance and I compared reading binary files
with Protobuf (I guess it works the same for CapnProto).
```
for i in {1..1000}; do clickhouse-client -q \
"select * from test.simple format Protobuf settings format_schema='/format_schemas/simple:KeyValuePair'" > simple-protobuf${i}.bin; done
clickhouse-client --time -q "select * from file('simple-protobuf{1..999}.bin', 'Protobuf') format Null settings format_schema = 'simple:KeyValuePair'"
```
Protobuf with cache and without works with approximately the same
time.
* Added a simple lttb aggregate function
* Added support for multiple datatypes
* Added support for Date and Date32, updated LTTBData struct
* Updated code to handle bucket size 0 and 1
* Added sort for LTTBData
* Added tests and documentation
* Added some code style fixes
* Added function to new func ref file
* Removed function from new func ref file
* Apply suggestions from code review
* Updated unit tests
* updated LTTB data code
* Minor style fixes
* Updated code with std sort
* updated tests
* Renamed lttb to largestTriangleThreeBuckets
* Added alias lttb
---------
Co-authored-by: Alexey Milovidov <milovidov@clickhouse.com>