dbms: more neat [#METR-2944].

This commit is contained in:
Alexey Milovidov 2014-10-07 02:48:20 +04:00
parent 3ff8c7ff26
commit a800baba16
4 changed files with 17 additions and 13 deletions

View File

@ -336,12 +336,12 @@ public:
ColumnPtr & getDataPtr() { return data; }
const ColumnPtr & getDataPtr() const { return data; }
Offsets_t & __attribute__((__always_inline__)) getOffsets()
Offsets_t & ALWAYS_INLINE getOffsets()
{
return static_cast<ColumnOffsets_t &>(*offsets.get()).getData();
}
const Offsets_t & __attribute__((__always_inline__)) getOffsets() const
const Offsets_t & ALWAYS_INLINE getOffsets() const
{
return static_cast<const ColumnOffsets_t &>(*offsets.get()).getData();
}
@ -373,8 +373,8 @@ private:
ColumnPtr data;
ColumnPtr offsets; /// Смещения могут быть разделяемыми для нескольких столбцов - для реализации вложенных структур данных.
size_t __attribute__((__always_inline__)) offsetAt(size_t i) const { return i == 0 ? 0 : getOffsets()[i - 1]; }
size_t __attribute__((__always_inline__)) sizeAt(size_t i) const { return i == 0 ? getOffsets()[0] : (getOffsets()[i] - getOffsets()[i - 1]); }
size_t ALWAYS_INLINE offsetAt(size_t i) const { return i == 0 ? 0 : getOffsets()[i - 1]; }
size_t ALWAYS_INLINE sizeAt(size_t i) const { return i == 0 ? getOffsets()[0] : (getOffsets()[i] - getOffsets()[i - 1]); }
/// Размножить значения, если вложенный столбец - ColumnArray<T>.

View File

@ -4,6 +4,7 @@
#include <Poco/SharedPtr.h>
#include <DB/Core/Defines.h>
#include <DB/Core/Exception.h>
#include <DB/Core/ErrorCodes.h>
@ -291,12 +292,12 @@ public:
// ColumnPtr & getDataPtr() { return data; }
// const ColumnPtr & getDataPtr() const { return data; }
Offsets_t & __attribute__((__always_inline__)) getOffsets()
Offsets_t & ALWAYS_INLINE getOffsets()
{
return static_cast<ColumnOffsets_t &>(*offsets.get()).getData();
}
const Offsets_t & __attribute__((__always_inline__)) getOffsets() const
const Offsets_t & ALWAYS_INLINE getOffsets() const
{
return static_cast<const ColumnOffsets_t &>(*offsets.get()).getData();
}
@ -308,8 +309,8 @@ private:
Columns data;
ColumnPtr offsets;
size_t __attribute__((__always_inline__)) offsetAt(size_t i) const { return i == 0 ? 0 : getOffsets()[i - 1]; }
size_t __attribute__((__always_inline__)) sizeAt(size_t i) const { return i == 0 ? getOffsets()[0] : (getOffsets()[i] - getOffsets()[i - 1]); }
size_t ALWAYS_INLINE offsetAt(size_t i) const { return i == 0 ? 0 : getOffsets()[i - 1]; }
size_t ALWAYS_INLINE sizeAt(size_t i) const { return i == 0 ? getOffsets()[0] : (getOffsets()[i] - getOffsets()[i - 1]); }
};

View File

@ -66,3 +66,5 @@
#define DBMS_MIN_REVISION_WITH_TEMPORARY_TABLES 50264
#define DBMS_DISTRIBUTED_DIRECTORY_MONITOR_SLEEP_TIME_MS 100
#define ALWAYS_INLINE __attribute__((__always_inline__))

View File

@ -6,6 +6,7 @@
#include <DB/Common/SipHash.h>
#include <DB/Common/Arena.h>
#include <DB/Common/UInt128.h>
#include <DB/Core/Defines.h>
#include <DB/Core/StringRef.h>
#include <DB/Columns/IColumn.h>
#include <DB/Common/HashTable/HashMap.h>
@ -22,7 +23,7 @@ typedef std::vector<size_t> Sizes;
/// Записать набор ключей фиксированной длины в UInt128, уложив их подряд (при допущении, что они помещаются).
static inline UInt128 __attribute__((__always_inline__)) pack128(
static inline UInt128 ALWAYS_INLINE pack128(
size_t i, size_t keys_size, const ConstColumnPlainPtrs & key_columns, const Sizes & key_sizes)
{
union
@ -45,7 +46,7 @@ static inline UInt128 __attribute__((__always_inline__)) pack128(
/// Хэшировать набор ключей в UInt128.
static inline UInt128 __attribute__((__always_inline__)) hash128(
static inline UInt128 ALWAYS_INLINE hash128(
size_t i, size_t keys_size, const ConstColumnPlainPtrs & key_columns, StringRefs & keys)
{
UInt128 key;
@ -65,7 +66,7 @@ static inline UInt128 __attribute__((__always_inline__)) hash128(
/// То же самое, но без возврата ссылок на данные ключей.
static inline UInt128 __attribute__((__always_inline__)) hash128(
static inline UInt128 ALWAYS_INLINE hash128(
size_t i, size_t keys_size, const ConstColumnPlainPtrs & key_columns)
{
UInt128 key;
@ -85,7 +86,7 @@ static inline UInt128 __attribute__((__always_inline__)) hash128(
/// Скопировать ключи в пул. Потом разместить в пуле StringRef-ы на них и вернуть указатель на первый.
static inline StringRef * __attribute__((__always_inline__)) placeKeysInPool(
static inline StringRef * ALWAYS_INLINE placeKeysInPool(
size_t i, size_t keys_size, StringRefs & keys, Arena & pool)
{
for (size_t j = 0; j < keys_size; ++j)
@ -104,7 +105,7 @@ static inline StringRef * __attribute__((__always_inline__)) placeKeysInPool(
/// Скопировать ключи в пул. Потом разместить в пуле StringRef-ы на них и вернуть указатель на первый.
static inline StringRef * __attribute__((__always_inline__)) extractKeysAndPlaceInPool(
static inline StringRef * ALWAYS_INLINE extractKeysAndPlaceInPool(
size_t i, size_t keys_size, const ConstColumnPlainPtrs & key_columns, StringRefs & keys, Arena & pool)
{
for (size_t j = 0; j < keys_size; ++j)