**Describe the bug**
I've found that quantileDeterministic and relevant functions are not deterministic

On 21.2.3 release:
```sql
SELECT medianDeterministic(oid, oid) FROM ztf.dr4_meta

┌─medianDeterministic(oid, oid)─┐
│               686709400040570 │
└───────────────────────────────┘

SELECT medianDeterministic(oid, oid) FROM ztf.dr4_meta

┌─medianDeterministic(oid, oid)─┐
│               686315850035097 │
└───────────────────────────────┘

SELECT medianDeterministic(oid, oid) FROM ztf.dr4_meta

┌─medianDeterministic(oid, oid)─┐
│               686316400060683 │
└───────────────────────────────┘
```

**Does it reproduce on recent release?**
Yes

**How to reproduce**
* Which ClickHouse server version to use: 21.2.3
* `CREATE TABLE` statements for all tables involved
```sql
CREATE TABLE dr4_meta
(
    `oid` UInt64 CODEC(Delta(8), LZ4),
    `nobs` UInt16 CODEC(T64, LZ4),
    `ngoodobs` UInt16 CODEC(T64, LZ4),
    `filter` UInt8 CODEC(T64, LZ4),
    `fieldid` UInt16 CODEC(T64, LZ4),
    `rcid` UInt8,
    `ra` Float64,
    `dec` Float64,
    `h3index10` UInt64,
    `durgood` Float64,
    `mingoodmag` Float32,
    `maxgoodmag` Float32,
    `meangoodmag` Float32
)
ENGINE = MergeTree()
ORDER BY oid
```
* Sample data for all these tables, use [clickhouse-obfuscator](https://github.com/ClickHouse/ClickHouse/blob/master/programs/obfuscator/Obfuscator.cpp#L42-L80) if necessary
[100GB tar](https://drive.google.com/file/d/1lRqzJx650MrTuY8SGfMTO9E_5U8xldL-/view?usp=sharing) of dr4_meta table

**Additional context**
20.6.4.1 works fine and always return `686316400060683`, while current version returns this or some other values. If `max_threads=1` is applied current version always returns `686709400040570`
bool sorted = false;
    Array samples;
    
    UInt8 skip_degree = 0;
    
    
    
    
    UInt32 skip_mask = 0;
    void insertImpl(const T & v, const UInt32 hash)
    {
        
        while (samples.size() >= max_sample_size)
            setSkipDegree(skip_degree + 1);
        samples.emplace_back(v, hash);
    }
    void setSkipDegree(UInt8 skip_degree_)
    {
        if (skip_degree_ == skip_degree)
            return;
        if (skip_degree_ > detail::MAX_SKIP_DEGREE)
            throw DB::Exception{"skip_degree exceeds maximum value", DB::ErrorCodes::MEMORY_LIMIT_EXCEEDED};
        skip_degree = skip_degree_;
        if (skip_degree == detail::MAX_SKIP_DEGREE)
            skip_mask = static_cast<UInt32>(-1);
        else
            skip_mask = (1 << skip_degree) - 1;
        thinOut();
    }
    void thinOut()