Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
5e89894b
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5e89894b
编写于
12月 10, 2018
作者:
P
proller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix style
上级
c9e98c8d
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
263 addition
and
254 deletion
+263
-254
.clang-format
.clang-format
+2
-1
dbms/src/Dictionaries/CacheDictionary.cpp
dbms/src/Dictionaries/CacheDictionary.cpp
+6
-5
dbms/src/Dictionaries/CacheDictionary.h
dbms/src/Dictionaries/CacheDictionary.h
+4
-4
dbms/src/Dictionaries/CacheDictionary.inc.h
dbms/src/Dictionaries/CacheDictionary.inc.h
+1
-1
dbms/src/Dictionaries/ComplexKeyCacheDictionary.cpp
dbms/src/Dictionaries/ComplexKeyCacheDictionary.cpp
+2
-1
dbms/src/Dictionaries/ComplexKeyCacheDictionary.h
dbms/src/Dictionaries/ComplexKeyCacheDictionary.h
+12
-12
dbms/src/Dictionaries/ComplexKeyCacheDictionary_createAttributeWithType.cpp
...ies/ComplexKeyCacheDictionary_createAttributeWithType.cpp
+4
-4
dbms/src/Dictionaries/ComplexKeyHashedDictionary.cpp
dbms/src/Dictionaries/ComplexKeyHashedDictionary.cpp
+55
-54
dbms/src/Dictionaries/ComplexKeyHashedDictionary.h
dbms/src/Dictionaries/ComplexKeyHashedDictionary.h
+11
-11
dbms/src/Dictionaries/ExecutableDictionarySource.cpp
dbms/src/Dictionaries/ExecutableDictionarySource.cpp
+2
-1
dbms/src/Dictionaries/FlatDictionary.cpp
dbms/src/Dictionaries/FlatDictionary.cpp
+37
-36
dbms/src/Dictionaries/FlatDictionary.h
dbms/src/Dictionaries/FlatDictionary.h
+4
-4
dbms/src/Dictionaries/HashedDictionary.cpp
dbms/src/Dictionaries/HashedDictionary.cpp
+38
-37
dbms/src/Dictionaries/HashedDictionary.h
dbms/src/Dictionaries/HashedDictionary.h
+5
-5
dbms/src/Dictionaries/RangeHashedDictionary.cpp
dbms/src/Dictionaries/RangeHashedDictionary.cpp
+10
-9
dbms/src/Dictionaries/RangeHashedDictionary.h
dbms/src/Dictionaries/RangeHashedDictionary.h
+4
-4
dbms/src/Dictionaries/TrieDictionary.cpp
dbms/src/Dictionaries/TrieDictionary.cpp
+55
-54
dbms/src/Dictionaries/TrieDictionary.h
dbms/src/Dictionaries/TrieDictionary.h
+11
-11
未找到文件。
.clang-format
浏览文件 @
5e89894b
...
...
@@ -50,7 +50,8 @@ IncludeCategories:
- Regex: '.*'
Priority: 40
ReflowComments: false
AlignEscapedNewlinesLeft: true
AlignEscapedNewlinesLeft: false
AlignEscapedNewlines: DontAlign
# Not changed:
AccessModifierOffset: -4
...
...
dbms/src/Dictionaries/CacheDictionary.cpp
浏览文件 @
5e89894b
...
...
@@ -377,11 +377,11 @@ CacheDictionary::Attribute CacheDictionary::createAttributeWithType(const Attrib
switch
(
type
)
{
#define DISPATCH(TYPE)
\
case AttributeUnderlyingType::TYPE:
\
#define DISPATCH(TYPE) \
case AttributeUnderlyingType::TYPE: \
attr.null_values = TYPE(null_value.get<NearestFieldType<TYPE>>()); \
attr.arrays = std::make_unique<ContainerType<TYPE>>(size);
\
bytes_allocated += size * sizeof(TYPE);
\
attr.arrays = std::make_unique<ContainerType<TYPE>>(size); \
bytes_allocated += size * sizeof(TYPE); \
break;
DISPATCH
(
UInt8
)
DISPATCH
(
UInt16
)
...
...
@@ -592,7 +592,8 @@ void registerDictionaryCache(DictionaryFactory & factory)
const
DictionaryStructure
&
dict_struct
,
const
Poco
::
Util
::
AbstractConfiguration
&
config
,
const
std
::
string
&
config_prefix
,
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
if
(
dict_struct
.
key
)
throw
Exception
{
"'key' is not supported for dictionary of layout 'cache'"
,
ErrorCodes
::
UNSUPPORTED_METHOD
};
...
...
dbms/src/Dictionaries/CacheDictionary.h
浏览文件 @
5e89894b
...
...
@@ -100,11 +100,11 @@ public:
void
getString
(
const
std
::
string
&
attribute_name
,
const
PaddedPODArray
<
Key
>
&
ids
,
ColumnString
*
out
)
const
;
#define DECLARE(TYPE)
\
void get##TYPE(
\
#define DECLARE(TYPE) \
void get##TYPE( \
const std::string & attribute_name, \
const PaddedPODArray<Key> & ids,
\
const PaddedPODArray<TYPE> & def,
\
const PaddedPODArray<Key> & ids, \
const PaddedPODArray<TYPE> & def, \
ResultArrayType<TYPE> & out) const;
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
dbms/src/Dictionaries/CacheDictionary.inc.h
浏览文件 @
5e89894b
...
...
@@ -40,7 +40,7 @@ void CacheDictionary::getItemsNumber(
if
(
false
)
{
}
#define DISPATCH(TYPE)
\
#define DISPATCH(TYPE) \
else if (attribute.type == AttributeUnderlyingType::TYPE) \
getItemsNumberImpl<TYPE, OutputType>(attribute, ids, out, std::forward<DefaultGetter>(get_default));
DISPATCH
(
UInt8
)
...
...
dbms/src/Dictionaries/ComplexKeyCacheDictionary.cpp
浏览文件 @
5e89894b
...
...
@@ -408,7 +408,8 @@ void registerDictionaryComplexKeyCache(DictionaryFactory & factory)
const
DictionaryStructure
&
dict_struct
,
const
Poco
::
Util
::
AbstractConfiguration
&
config
,
const
std
::
string
&
config_prefix
,
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
if
(
!
dict_struct
.
key
)
throw
Exception
{
"'key' is required for dictionary of layout 'complex_key_hashed'"
,
ErrorCodes
::
BAD_ARGUMENTS
};
const
auto
&
layout_prefix
=
config_prefix
+
".layout"
;
...
...
dbms/src/Dictionaries/ComplexKeyCacheDictionary.h
浏览文件 @
5e89894b
...
...
@@ -97,7 +97,7 @@ public:
/// In all functions below, key_columns must be full (non-constant) columns.
/// See the requirement in IDataType.h for text-serialization functions.
#define DECLARE(TYPE) \
void get##TYPE(
\
void get##TYPE( \
const std::string & attribute_name, const Columns & key_columns, const DataTypes & key_types, ResultArrayType<TYPE> & out) const;
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -117,12 +117,12 @@ public:
void
getString
(
const
std
::
string
&
attribute_name
,
const
Columns
&
key_columns
,
const
DataTypes
&
key_types
,
ColumnString
*
out
)
const
;
#define DECLARE(TYPE)
\
void get##TYPE(
\
#define DECLARE(TYPE) \
void get##TYPE( \
const std::string & attribute_name, \
const Columns & key_columns,
\
const DataTypes & key_types,
\
const PaddedPODArray<TYPE> & def,
\
const Columns & key_columns, \
const DataTypes & key_types, \
const PaddedPODArray<TYPE> & def, \
ResultArrayType<TYPE> & out) const;
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -147,12 +147,12 @@ public:
const
ColumnString
*
const
def
,
ColumnString
*
const
out
)
const
;
#define DECLARE(TYPE)
\
void get##TYPE(
\
#define DECLARE(TYPE) \
void get##TYPE( \
const std::string & attribute_name, \
const Columns & key_columns,
\
const DataTypes & key_types,
\
const TYPE def,
\
const Columns & key_columns, \
const DataTypes & key_types, \
const TYPE def, \
ResultArrayType<TYPE> & out) const;
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -261,7 +261,7 @@ private:
if
(
false
)
{
}
#define DISPATCH(TYPE)
\
#define DISPATCH(TYPE) \
else if (attribute.type == AttributeUnderlyingType::TYPE) \
getItemsNumberImpl<TYPE, OutputType>(attribute, key_columns, out, std::forward<DefaultGetter>(get_default));
DISPATCH
(
UInt8
)
...
...
dbms/src/Dictionaries/ComplexKeyCacheDictionary_createAttributeWithType.cpp
浏览文件 @
5e89894b
...
...
@@ -9,11 +9,11 @@ ComplexKeyCacheDictionary::createAttributeWithType(const AttributeUnderlyingType
switch
(
type
)
{
#define DISPATCH(TYPE)
\
case AttributeUnderlyingType::TYPE:
\
#define DISPATCH(TYPE) \
case AttributeUnderlyingType::TYPE: \
attr.null_values = TYPE(null_value.get<NearestFieldType<TYPE>>()); \
attr.arrays = std::make_unique<ContainerType<TYPE>>(size);
\
bytes_allocated += size * sizeof(TYPE);
\
attr.arrays = std::make_unique<ContainerType<TYPE>>(size); \
bytes_allocated += size * sizeof(TYPE); \
break;
DISPATCH
(
UInt8
)
DISPATCH
(
UInt16
)
...
...
dbms/src/Dictionaries/ComplexKeyHashedDictionary.cpp
浏览文件 @
5e89894b
...
...
@@ -49,24 +49,24 @@ ComplexKeyHashedDictionary::ComplexKeyHashedDictionary(const ComplexKeyHashedDic
{
}
#define DECLARE(TYPE)
\
void ComplexKeyHashedDictionary::get##TYPE(
\
#define DECLARE(TYPE) \
void ComplexKeyHashedDictionary::get##TYPE( \
const std::string & attribute_name, const Columns & key_columns, const DataTypes & key_types, ResultArrayType<TYPE> & out) const \
{
\
dict_struct.validateKeyTypes(key_types);
\
\
const auto & attribute = getAttribute(attribute_name);
\
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))
\
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),
\
ErrorCodes::TYPE_MISMATCH};
\
\
const auto null_value = std::get<TYPE>(attribute.null_values);
\
\
getItemsNumber<TYPE>(
\
attribute,
\
key_columns,
\
[&](const size_t row, const auto value) { out[row] = value; },
\
[&](const size_t) { return null_value; });
\
{ \
dict_struct.validateKeyTypes(key_types); \
\
const auto & attribute = getAttribute(attribute_name); \
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE)) \
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), \
ErrorCodes::TYPE_MISMATCH}; \
\
const auto null_value = std::get<TYPE>(attribute.null_values); \
\
getItemsNumber<TYPE>( \
attribute, \
key_columns, \
[&](const size_t row, const auto value) { out[row] = value; }, \
[&](const size_t) { return null_value; }); \
}
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -103,26 +103,26 @@ void ComplexKeyHashedDictionary::getString(
[
&
](
const
size_t
)
{
return
null_value
;
});
}
#define DECLARE(TYPE)
\
void ComplexKeyHashedDictionary::get##TYPE(
\
const std::string & attribute_name,
\
const Columns & key_columns,
\
const DataTypes & key_types,
\
const PaddedPODArray<TYPE> & def,
\
ResultArrayType<TYPE> & out) const
\
{
\
dict_struct.validateKeyTypes(key_types);
\
\
const auto & attribute = getAttribute(attribute_name);
\
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))
\
#define DECLARE(TYPE) \
void ComplexKeyHashedDictionary::get##TYPE( \
const std::string & attribute_name, \
const Columns & key_columns, \
const DataTypes & key_types, \
const PaddedPODArray<TYPE> & def, \
ResultArrayType<TYPE> & out) const \
{ \
dict_struct.validateKeyTypes(key_types); \
\
const auto & attribute = getAttribute(attribute_name); \
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE)) \
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), \
ErrorCodes::TYPE_MISMATCH};
\
\
getItemsNumber<TYPE>(
\
attribute,
\
key_columns,
\
[&](const size_t row, const auto value) { out[row] = value; },
\
[&](const size_t row) { return def[row]; });
\
ErrorCodes::TYPE_MISMATCH}; \
\
getItemsNumber<TYPE>( \
attribute, \
key_columns, \
[&](const size_t row, const auto value) { out[row] = value; }, \
[&](const size_t row) { return def[row]; }); \
}
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -161,22 +161,22 @@ void ComplexKeyHashedDictionary::getString(
[
&
](
const
size_t
row
)
{
return
def
->
getDataAt
(
row
);
});
}
#define DECLARE(TYPE)
\
void ComplexKeyHashedDictionary::get##TYPE(
\
const std::string & attribute_name,
\
const Columns & key_columns,
\
const DataTypes & key_types,
\
const TYPE def,
\
ResultArrayType<TYPE> & out) const
\
{
\
dict_struct.validateKeyTypes(key_types);
\
\
const auto & attribute = getAttribute(attribute_name);
\
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))
\
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),
\
ErrorCodes::TYPE_MISMATCH};
\
\
getItemsNumber<TYPE>(
\
#define DECLARE(TYPE) \
void ComplexKeyHashedDictionary::get##TYPE( \
const std::string & attribute_name, \
const Columns & key_columns, \
const DataTypes & key_types, \
const TYPE def, \
ResultArrayType<TYPE> & out) const \
{ \
dict_struct.validateKeyTypes(key_types); \
\
const auto & attribute = getAttribute(attribute_name); \
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE)) \
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), \
ErrorCodes::TYPE_MISMATCH}; \
\
getItemsNumber<TYPE>( \
attribute, key_columns, [&](const size_t row, const auto value) { out[row] = value; }, [&](const size_t) { return def; }); \
}
DECLARE
(
UInt8
)
...
...
@@ -579,7 +579,7 @@ void ComplexKeyHashedDictionary::getItemsNumber(
if
(
false
)
{
}
#define DISPATCH(TYPE)
\
#define DISPATCH(TYPE) \
else if (attribute.type == AttributeUnderlyingType::TYPE) getItemsImpl<TYPE, OutputType>( \
attribute, key_columns, std::forward<ValueSetter>(set_value), std::forward<DefaultGetter>(get_default));
DISPATCH
(
UInt8
)
...
...
@@ -802,7 +802,8 @@ void registerDictionaryComplexKeyHashed(DictionaryFactory & factory)
const
DictionaryStructure
&
dict_struct
,
const
Poco
::
Util
::
AbstractConfiguration
&
config
,
const
std
::
string
&
config_prefix
,
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
if
(
!
dict_struct
.
key
)
throw
Exception
{
"'key' is required for dictionary of layout 'complex_key_hashed'"
,
ErrorCodes
::
BAD_ARGUMENTS
};
...
...
dbms/src/Dictionaries/ComplexKeyHashedDictionary.h
浏览文件 @
5e89894b
...
...
@@ -70,7 +70,7 @@ public:
using
ResultArrayType
=
std
::
conditional_t
<
IsDecimalNumber
<
T
>
,
DecimalPaddedPODArray
<
T
>
,
PaddedPODArray
<
T
>>
;
#define DECLARE(TYPE) \
void get##TYPE(
\
void get##TYPE( \
const std::string & attribute_name, const Columns & key_columns, const DataTypes & key_types, ResultArrayType<TYPE> & out) const;
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -90,12 +90,12 @@ public:
void
getString
(
const
std
::
string
&
attribute_name
,
const
Columns
&
key_columns
,
const
DataTypes
&
key_types
,
ColumnString
*
out
)
const
;
#define DECLARE(TYPE)
\
void get##TYPE(
\
#define DECLARE(TYPE) \
void get##TYPE( \
const std::string & attribute_name, \
const Columns & key_columns,
\
const DataTypes & key_types,
\
const PaddedPODArray<TYPE> & def,
\
const Columns & key_columns, \
const DataTypes & key_types, \
const PaddedPODArray<TYPE> & def, \
ResultArrayType<TYPE> & out) const;
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -120,12 +120,12 @@ public:
const
ColumnString
*
const
def
,
ColumnString
*
const
out
)
const
;
#define DECLARE(TYPE)
\
void get##TYPE(
\
#define DECLARE(TYPE) \
void get##TYPE( \
const std::string & attribute_name, \
const Columns & key_columns,
\
const DataTypes & key_types,
\
const TYPE def,
\
const Columns & key_columns, \
const DataTypes & key_types, \
const TYPE def, \
ResultArrayType<TYPE> & out) const;
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
dbms/src/Dictionaries/ExecutableDictionarySource.cpp
浏览文件 @
5e89894b
...
...
@@ -193,7 +193,8 @@ BlockInputStreamPtr ExecutableDictionarySource::loadKeys(const Columns & key_col
auto
input_stream
=
context
.
getInputFormat
(
format
,
process
->
out
,
sample_block
,
max_block_size
);
return
std
::
make_shared
<
BlockInputStreamWithBackgroundThread
>
(
input_stream
,
std
::
move
(
process
),
std
::
packaged_task
<
void
()
>
([
output_stream
,
key_columns
,
&
requested_rows
,
this
]()
mutable
{
input_stream
,
std
::
move
(
process
),
std
::
packaged_task
<
void
()
>
([
output_stream
,
key_columns
,
&
requested_rows
,
this
]()
mutable
{
formatKeys
(
dict_struct
,
output_stream
,
key_columns
,
requested_rows
);
}));
}
...
...
dbms/src/Dictionaries/FlatDictionary.cpp
浏览文件 @
5e89894b
...
...
@@ -119,18 +119,18 @@ void FlatDictionary::isInConstantVector(const Key child_id, const PaddedPODArray
}
#define DECLARE(TYPE)
\
#define DECLARE(TYPE) \
void FlatDictionary::get##TYPE(const std::string & attribute_name, const PaddedPODArray<Key> & ids, ResultArrayType<TYPE> & out) const \
{
\
const auto & attribute = getAttribute(attribute_name);
\
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))
\
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),
\
ErrorCodes::TYPE_MISMATCH};
\
\
const auto null_value = std::get<TYPE>(attribute.null_values);
\
\
getItemsNumber<TYPE>(
\
attribute, ids, [&](const size_t row, const auto value) { out[row] = value; }, [&](const size_t) { return null_value; });
\
{ \
const auto & attribute = getAttribute(attribute_name); \
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE)) \
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), \
ErrorCodes::TYPE_MISMATCH}; \
\
const auto null_value = std::get<TYPE>(attribute.null_values); \
\
getItemsNumber<TYPE>( \
attribute, ids, [&](const size_t row, const auto value) { out[row] = value; }, [&](const size_t) { return null_value; }); \
}
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -164,19 +164,19 @@ void FlatDictionary::getString(const std::string & attribute_name, const PaddedP
[
&
](
const
size_t
)
{
return
null_value
;
});
}
#define DECLARE(TYPE)
\
void FlatDictionary::get##TYPE(
\
const std::string & attribute_name,
\
const PaddedPODArray<Key> & ids,
\
const PaddedPODArray<TYPE> & def,
\
ResultArrayType<TYPE> & out) const
\
{
\
const auto & attribute = getAttribute(attribute_name);
\
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))
\
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),
\
ErrorCodes::TYPE_MISMATCH};
\
\
getItemsNumber<TYPE>(
\
#define DECLARE(TYPE) \
void FlatDictionary::get##TYPE( \
const std::string & attribute_name, \
const PaddedPODArray<Key> & ids, \
const PaddedPODArray<TYPE> & def, \
ResultArrayType<TYPE> & out) const \
{ \
const auto & attribute = getAttribute(attribute_name); \
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE)) \
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), \
ErrorCodes::TYPE_MISMATCH}; \
\
getItemsNumber<TYPE>( \
attribute, ids, [&](const size_t row, const auto value) { out[row] = value; }, [&](const size_t row) { return def[row]; }); \
}
DECLARE
(
UInt8
)
...
...
@@ -210,17 +210,17 @@ void FlatDictionary::getString(
[
&
](
const
size_t
row
)
{
return
def
->
getDataAt
(
row
);
});
}
#define DECLARE(TYPE)
\
void FlatDictionary::get##TYPE(
\
#define DECLARE(TYPE) \
void FlatDictionary::get##TYPE( \
const std::string & attribute_name, const PaddedPODArray<Key> & ids, const TYPE def, ResultArrayType<TYPE> & out) const \
{
\
const auto & attribute = getAttribute(attribute_name);
\
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))
\
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),
\
ErrorCodes::TYPE_MISMATCH};
\
\
getItemsNumber<TYPE>(
\
attribute, ids, [&](const size_t row, const auto value) { out[row] = value; }, [&](const size_t) { return def; });
\
{ \
const auto & attribute = getAttribute(attribute_name); \
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE)) \
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), \
ErrorCodes::TYPE_MISMATCH}; \
\
getItemsNumber<TYPE>( \
attribute, ids, [&](const size_t row, const auto value) { out[row] = value; }, [&](const size_t) { return def; }); \
}
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -593,7 +593,7 @@ void FlatDictionary::getItemsNumber(
if
(
false
)
{
}
#define DISPATCH(TYPE)
\
#define DISPATCH(TYPE) \
else if (attribute.type == AttributeUnderlyingType::TYPE) \
getItemsImpl<TYPE, OutputType>(attribute, ids, std::forward<ValueSetter>(set_value), std::forward<DefaultGetter>(get_default));
DISPATCH
(
UInt8
)
...
...
@@ -767,7 +767,8 @@ void registerDictionaryFlat(DictionaryFactory & factory)
const
DictionaryStructure
&
dict_struct
,
const
Poco
::
Util
::
AbstractConfiguration
&
config
,
const
std
::
string
&
config_prefix
,
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
if
(
dict_struct
.
key
)
throw
Exception
{
"'key' is not supported for dictionary of layout 'flat'"
,
ErrorCodes
::
UNSUPPORTED_METHOD
};
...
...
dbms/src/Dictionaries/FlatDictionary.h
浏览文件 @
5e89894b
...
...
@@ -95,11 +95,11 @@ public:
void
getString
(
const
std
::
string
&
attribute_name
,
const
PaddedPODArray
<
Key
>
&
ids
,
ColumnString
*
out
)
const
;
#define DECLARE(TYPE)
\
void get##TYPE(
\
#define DECLARE(TYPE) \
void get##TYPE( \
const std::string & attribute_name, \
const PaddedPODArray<Key> & ids,
\
const PaddedPODArray<TYPE> & def,
\
const PaddedPODArray<Key> & ids, \
const PaddedPODArray<TYPE> & def, \
ResultArrayType<TYPE> & out) const;
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
dbms/src/Dictionaries/HashedDictionary.cpp
浏览文件 @
5e89894b
...
...
@@ -117,19 +117,19 @@ void HashedDictionary::isInConstantVector(const Key child_id, const PaddedPODArr
}
#define DECLARE(TYPE)
\
#define DECLARE(TYPE) \
void HashedDictionary::get##TYPE(const std::string & attribute_name, const PaddedPODArray<Key> & ids, ResultArrayType<TYPE> & out) \
const
\
{
\
const auto & attribute = getAttribute(attribute_name);
\
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))
\
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),
\
ErrorCodes::TYPE_MISMATCH};
\
\
const auto null_value = std::get<TYPE>(attribute.null_values);
\
\
getItemsNumber<TYPE>(
\
attribute, ids, [&](const size_t row, const auto value) { out[row] = value; }, [&](const size_t) { return null_value; });
\
const \
{ \
const auto & attribute = getAttribute(attribute_name); \
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE)) \
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), \
ErrorCodes::TYPE_MISMATCH}; \
\
const auto null_value = std::get<TYPE>(attribute.null_values); \
\
getItemsNumber<TYPE>( \
attribute, ids, [&](const size_t row, const auto value) { out[row] = value; }, [&](const size_t) { return null_value; }); \
}
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -163,19 +163,19 @@ void HashedDictionary::getString(const std::string & attribute_name, const Padde
[
&
](
const
size_t
)
{
return
null_value
;
});
}
#define DECLARE(TYPE)
\
void HashedDictionary::get##TYPE(
\
const std::string & attribute_name,
\
const PaddedPODArray<Key> & ids,
\
const PaddedPODArray<TYPE> & def,
\
ResultArrayType<TYPE> & out) const
\
{
\
const auto & attribute = getAttribute(attribute_name);
\
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))
\
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),
\
ErrorCodes::TYPE_MISMATCH};
\
\
getItemsNumber<TYPE>(
\
#define DECLARE(TYPE) \
void HashedDictionary::get##TYPE( \
const std::string & attribute_name, \
const PaddedPODArray<Key> & ids, \
const PaddedPODArray<TYPE> & def, \
ResultArrayType<TYPE> & out) const \
{ \
const auto & attribute = getAttribute(attribute_name); \
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE)) \
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), \
ErrorCodes::TYPE_MISMATCH}; \
\
getItemsNumber<TYPE>( \
attribute, ids, [&](const size_t row, const auto value) { out[row] = value; }, [&](const size_t row) { return def[row]; }); \
}
DECLARE
(
UInt8
)
...
...
@@ -209,17 +209,17 @@ void HashedDictionary::getString(
[
&
](
const
size_t
row
)
{
return
def
->
getDataAt
(
row
);
});
}
#define DECLARE(TYPE)
\
void HashedDictionary::get##TYPE(
\
#define DECLARE(TYPE) \
void HashedDictionary::get##TYPE( \
const std::string & attribute_name, const PaddedPODArray<Key> & ids, const TYPE & def, ResultArrayType<TYPE> & out) const \
{
\
const auto & attribute = getAttribute(attribute_name);
\
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))
\
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),
\
ErrorCodes::TYPE_MISMATCH};
\
\
getItemsNumber<TYPE>(
\
attribute, ids, [&](const size_t row, const auto value) { out[row] = value; }, [&](const size_t) { return def; });
\
{ \
const auto & attribute = getAttribute(attribute_name); \
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE)) \
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), \
ErrorCodes::TYPE_MISMATCH}; \
\
getItemsNumber<TYPE>( \
attribute, ids, [&](const size_t row, const auto value) { out[row] = value; }, [&](const size_t) { return def; }); \
}
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -580,7 +580,7 @@ void HashedDictionary::getItemsNumber(
if
(
false
)
{
}
#define DISPATCH(TYPE)
\
#define DISPATCH(TYPE) \
else if (attribute.type == AttributeUnderlyingType::TYPE) \
getItemsImpl<TYPE, OutputType>(attribute, ids, std::forward<ValueSetter>(set_value), std::forward<DefaultGetter>(get_default));
DISPATCH
(
UInt8
)
...
...
@@ -771,7 +771,8 @@ void registerDictionaryHashed(DictionaryFactory & factory)
const
DictionaryStructure
&
dict_struct
,
const
Poco
::
Util
::
AbstractConfiguration
&
config
,
const
std
::
string
&
config_prefix
,
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
if
(
dict_struct
.
key
)
throw
Exception
{
"'key' is not supported for dictionary of layout 'hashed'"
,
ErrorCodes
::
UNSUPPORTED_METHOD
};
...
...
dbms/src/Dictionaries/HashedDictionary.h
浏览文件 @
5e89894b
...
...
@@ -89,11 +89,11 @@ public:
void
getString
(
const
std
::
string
&
attribute_name
,
const
PaddedPODArray
<
Key
>
&
ids
,
ColumnString
*
out
)
const
;
#define DECLARE(TYPE)
\
void get##TYPE(
\
#define DECLARE(TYPE) \
void get##TYPE( \
const std::string & attribute_name, \
const PaddedPODArray<Key> & ids,
\
const PaddedPODArray<TYPE> & def,
\
const PaddedPODArray<Key> & ids, \
const PaddedPODArray<TYPE> & def, \
ResultArrayType<TYPE> & out) const;
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -115,7 +115,7 @@ public:
getString
(
const
std
::
string
&
attribute_name
,
const
PaddedPODArray
<
Key
>
&
ids
,
const
ColumnString
*
const
def
,
ColumnString
*
const
out
)
const
;
#define DECLARE(TYPE)
\
#define DECLARE(TYPE) \
void get##TYPE(const std::string & attribute_name, const PaddedPODArray<Key> & ids, const TYPE & def, ResultArrayType<TYPE> & out) \
const;
DECLARE
(
UInt8
)
...
...
dbms/src/Dictionaries/RangeHashedDictionary.cpp
浏览文件 @
5e89894b
...
...
@@ -101,15 +101,15 @@ RangeHashedDictionary::RangeHashedDictionary(const RangeHashedDictionary & other
}
#define DECLARE_MULTIPLE_GETTER(TYPE)
\
void RangeHashedDictionary::get##TYPE(
\
const std::string & attribute_name,
\
const PaddedPODArray<Key> & ids,
\
const PaddedPODArray<RangeStorageType> & dates,
\
ResultArrayType<TYPE> & out) const
\
{
\
#define DECLARE_MULTIPLE_GETTER(TYPE) \
void RangeHashedDictionary::get##TYPE( \
const std::string & attribute_name, \
const PaddedPODArray<Key> & ids, \
const PaddedPODArray<RangeStorageType> & dates, \
ResultArrayType<TYPE> & out) const \
{ \
const auto & attribute = getAttributeWithType(attribute_name, AttributeUnderlyingType::TYPE); \
getItems<TYPE>(attribute, ids, dates, out);
\
getItems<TYPE>(attribute, ids, dates, out); \
}
DECLARE_MULTIPLE_GETTER
(
UInt8
)
DECLARE_MULTIPLE_GETTER
(
UInt16
)
...
...
@@ -694,7 +694,8 @@ void registerDictionaryRangeHashed(DictionaryFactory & factory)
const
DictionaryStructure
&
dict_struct
,
const
Poco
::
Util
::
AbstractConfiguration
&
config
,
const
std
::
string
&
config_prefix
,
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
if
(
dict_struct
.
key
)
throw
Exception
{
"'key' is not supported for dictionary of layout 'range_hashed'"
,
ErrorCodes
::
UNSUPPORTED_METHOD
};
...
...
dbms/src/Dictionaries/RangeHashedDictionary.h
浏览文件 @
5e89894b
...
...
@@ -64,10 +64,10 @@ public:
template
<
typename
T
>
using
ResultArrayType
=
std
::
conditional_t
<
IsDecimalNumber
<
T
>
,
DecimalPaddedPODArray
<
T
>
,
PaddedPODArray
<
T
>>
;
#define DECLARE_MULTIPLE_GETTER(TYPE)
\
void get##TYPE(
\
const std::string & attribute_name,
\
const PaddedPODArray<Key> & ids,
\
#define DECLARE_MULTIPLE_GETTER(TYPE) \
void get##TYPE( \
const std::string & attribute_name, \
const PaddedPODArray<Key> & ids, \
const PaddedPODArray<RangeStorageType> & dates, \
ResultArrayType<TYPE> & out) const;
DECLARE_MULTIPLE_GETTER
(
UInt8
)
...
...
dbms/src/Dictionaries/TrieDictionary.cpp
浏览文件 @
5e89894b
...
...
@@ -66,24 +66,24 @@ TrieDictionary::~TrieDictionary()
btrie_destroy
(
trie
);
}
#define DECLARE(TYPE)
\
void TrieDictionary::get##TYPE(
\
#define DECLARE(TYPE) \
void TrieDictionary::get##TYPE( \
const std::string & attribute_name, const Columns & key_columns, const DataTypes & key_types, ResultArrayType<TYPE> & out) const \
{
\
validateKeyTypes(key_types);
\
\
const auto & attribute = getAttribute(attribute_name);
\
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))
\
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),
\
ErrorCodes::TYPE_MISMATCH};
\
\
const auto null_value = std::get<TYPE>(attribute.null_values);
\
\
getItemsNumber<TYPE>(
\
attribute,
\
key_columns,
\
[&](const size_t row, const auto value) { out[row] = value; },
\
[&](const size_t) { return null_value; });
\
{ \
validateKeyTypes(key_types); \
\
const auto & attribute = getAttribute(attribute_name); \
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE)) \
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), \
ErrorCodes::TYPE_MISMATCH}; \
\
const auto null_value = std::get<TYPE>(attribute.null_values); \
\
getItemsNumber<TYPE>( \
attribute, \
key_columns, \
[&](const size_t row, const auto value) { out[row] = value; }, \
[&](const size_t) { return null_value; }); \
}
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -120,26 +120,26 @@ void TrieDictionary::getString(
[
&
](
const
size_t
)
{
return
null_value
;
});
}
#define DECLARE(TYPE)
\
void TrieDictionary::get##TYPE(
\
const std::string & attribute_name,
\
const Columns & key_columns,
\
const DataTypes & key_types,
\
const PaddedPODArray<TYPE> & def,
\
ResultArrayType<TYPE> & out) const
\
{
\
validateKeyTypes(key_types);
\
\
const auto & attribute = getAttribute(attribute_name);
\
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))
\
#define DECLARE(TYPE) \
void TrieDictionary::get##TYPE( \
const std::string & attribute_name, \
const Columns & key_columns, \
const DataTypes & key_types, \
const PaddedPODArray<TYPE> & def, \
ResultArrayType<TYPE> & out) const \
{ \
validateKeyTypes(key_types); \
\
const auto & attribute = getAttribute(attribute_name); \
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE)) \
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), \
ErrorCodes::TYPE_MISMATCH};
\
\
getItemsNumber<TYPE>(
\
attribute,
\
key_columns,
\
[&](const size_t row, const auto value) { out[row] = value; },
\
[&](const size_t row) { return def[row]; });
\
ErrorCodes::TYPE_MISMATCH}; \
\
getItemsNumber<TYPE>( \
attribute, \
key_columns, \
[&](const size_t row, const auto value) { out[row] = value; }, \
[&](const size_t row) { return def[row]; }); \
}
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -178,22 +178,22 @@ void TrieDictionary::getString(
[
&
](
const
size_t
row
)
{
return
def
->
getDataAt
(
row
);
});
}
#define DECLARE(TYPE)
\
void TrieDictionary::get##TYPE(
\
const std::string & attribute_name,
\
const Columns & key_columns,
\
const DataTypes & key_types,
\
const TYPE def,
\
ResultArrayType<TYPE> & out) const
\
{
\
validateKeyTypes(key_types);
\
\
const auto & attribute = getAttribute(attribute_name);
\
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))
\
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),
\
ErrorCodes::TYPE_MISMATCH};
\
\
getItemsNumber<TYPE>(
\
#define DECLARE(TYPE) \
void TrieDictionary::get##TYPE( \
const std::string & attribute_name, \
const Columns & key_columns, \
const DataTypes & key_types, \
const TYPE def, \
ResultArrayType<TYPE> & out) const \
{ \
validateKeyTypes(key_types); \
\
const auto & attribute = getAttribute(attribute_name); \
if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE)) \
throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), \
ErrorCodes::TYPE_MISMATCH}; \
\
getItemsNumber<TYPE>( \
attribute, key_columns, [&](const size_t row, const auto value) { out[row] = value; }, [&](const size_t) { return def; }); \
}
DECLARE
(
UInt8
)
...
...
@@ -512,7 +512,7 @@ void TrieDictionary::getItemsNumber(
if
(
false
)
{
}
#define DISPATCH(TYPE)
\
#define DISPATCH(TYPE) \
else if (attribute.type == AttributeUnderlyingType::TYPE) getItemsImpl<TYPE, OutputType>( \
attribute, key_columns, std::forward<ValueSetter>(set_value), std::forward<DefaultGetter>(get_default));
DISPATCH
(
UInt8
)
...
...
@@ -795,7 +795,8 @@ void registerDictionaryTrie(DictionaryFactory & factory)
const
DictionaryStructure
&
dict_struct
,
const
Poco
::
Util
::
AbstractConfiguration
&
config
,
const
std
::
string
&
config_prefix
,
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
DictionarySourcePtr
source_ptr
)
->
DictionaryPtr
{
if
(
!
dict_struct
.
key
)
throw
Exception
{
"'key' is required for dictionary of layout 'ip_trie'"
,
ErrorCodes
::
BAD_ARGUMENTS
};
...
...
dbms/src/Dictionaries/TrieDictionary.h
浏览文件 @
5e89894b
...
...
@@ -72,7 +72,7 @@ public:
using
ResultArrayType
=
std
::
conditional_t
<
IsDecimalNumber
<
T
>
,
DecimalPaddedPODArray
<
T
>
,
PaddedPODArray
<
T
>>
;
#define DECLARE(TYPE) \
void get##TYPE(
\
void get##TYPE( \
const std::string & attribute_name, const Columns & key_columns, const DataTypes & key_types, ResultArrayType<TYPE> & out) const;
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -92,12 +92,12 @@ public:
void
getString
(
const
std
::
string
&
attribute_name
,
const
Columns
&
key_columns
,
const
DataTypes
&
key_types
,
ColumnString
*
out
)
const
;
#define DECLARE(TYPE)
\
void get##TYPE(
\
#define DECLARE(TYPE) \
void get##TYPE( \
const std::string & attribute_name, \
const Columns & key_columns,
\
const DataTypes & key_types,
\
const PaddedPODArray<TYPE> & def,
\
const Columns & key_columns, \
const DataTypes & key_types, \
const PaddedPODArray<TYPE> & def, \
ResultArrayType<TYPE> & out) const;
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
@@ -122,12 +122,12 @@ public:
const
ColumnString
*
const
def
,
ColumnString
*
const
out
)
const
;
#define DECLARE(TYPE)
\
void get##TYPE(
\
#define DECLARE(TYPE) \
void get##TYPE( \
const std::string & attribute_name, \
const Columns & key_columns,
\
const DataTypes & key_types,
\
const TYPE def,
\
const Columns & key_columns, \
const DataTypes & key_types, \
const TYPE def, \
ResultArrayType<TYPE> & out) const;
DECLARE
(
UInt8
)
DECLARE
(
UInt16
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录