Add comment for used_flags in hash join, fix build

This commit is contained in:
vdimir 2021-02-08 14:38:31 +03:00
parent 01a6e01ad7
commit 776b682f28
No known key found for this signature in database
GPG Key ID: F57B3E10A21DBB31
5 changed files with 18 additions and 0 deletions

View File

@ -87,6 +87,9 @@ public:
bool isInserted() const { return inserted; }
};
/// FindResult optionally may contain pointer to value and offset in hashtable buffer.
/// Only bool found is required.
/// So we will have 4 different specializations for FindResultImpl
class FindResultImplBase
{
bool found;
@ -241,6 +244,8 @@ protected:
{
if constexpr (Cache::consecutive_keys_optimization)
{
/// It's possible to support such combination, but code will became more complex.
/// Now there's not place where we need this options enabled together
static_assert(!FindResult::has_offset, "`consecutive_keys_optimization` and `has_offset` are conflicting options");
if (cache.check(key))
{

View File

@ -476,6 +476,10 @@ public:
size_t getBufferSizeInCells() const { return NUM_CELLS; }
/// Return offset for result in internal buffer.
/// Result can have value up to `getBufferSizeInCells() + 1`
/// because offset for zero value considered to be 0
/// and for other values it will be `offset in buffer + 1`
size_t offsetInternal(ConstLookupResult ptr) const
{
if (ptr->isZero(*this))

View File

@ -1214,6 +1214,10 @@ public:
return grower.bufSize();
}
/// Return offset for result in internal buffer.
/// Result can have value up to `getBufferSizeInCells() + 1`
/// because offset for zero value considered to be 0
/// and for other values it will be `offset in buffer + 1`
size_t offsetInternal(ConstLookupResult ptr) const
{
if (ptr->isZero(*this))

View File

@ -57,6 +57,7 @@ struct NotProcessedCrossJoin : public ExtraBlock
namespace JoinStuff
{
/// Version of `getUsed` with dynamic dispatch
bool JoinUsedFlags::getUsedSafe(size_t i) const
{
if (flags.empty())
@ -576,6 +577,7 @@ namespace
APPLY_FOR_JOIN_VARIANTS(M)
#undef M
}
__builtin_unreachable();
}
}

View File

@ -350,6 +350,9 @@ private:
/// Right table data. StorageJoin shares it between many Join objects.
std::shared_ptr<RightTableData> data;
/// Flags that indicate that particular row already used in join.
/// Flag is stored for every record in hash map.
/// Number of this flags equals to hashtable buffer size (plus one for zero value).
mutable JoinStuff::JoinUsedFlags used_flags;
Sizes key_sizes;