Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
fbb0a3e7
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,发现更多精彩内容 >>
提交
fbb0a3e7
编写于
12月 14, 2016
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Working on performance of hierarchical external dictionaries [#METR-23747].
上级
dd1636ab
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
82 addition
and
63 deletion
+82
-63
dbms/include/DB/Dictionaries/CacheDictionary.h
dbms/include/DB/Dictionaries/CacheDictionary.h
+3
-3
dbms/include/DB/Dictionaries/FlatDictionary.h
dbms/include/DB/Dictionaries/FlatDictionary.h
+3
-3
dbms/include/DB/Dictionaries/HashedDictionary.h
dbms/include/DB/Dictionaries/HashedDictionary.h
+3
-3
dbms/include/DB/Dictionaries/IDictionary.h
dbms/include/DB/Dictionaries/IDictionary.h
+5
-5
dbms/include/DB/Functions/FunctionsDictionaries.h
dbms/include/DB/Functions/FunctionsDictionaries.h
+46
-43
dbms/src/Dictionaries/CacheDictionary.cpp
dbms/src/Dictionaries/CacheDictionary.cpp
+16
-0
dbms/src/Dictionaries/FlatDictionary.cpp
dbms/src/Dictionaries/FlatDictionary.cpp
+3
-3
dbms/src/Dictionaries/HashedDictionary.cpp
dbms/src/Dictionaries/HashedDictionary.cpp
+3
-3
未找到文件。
dbms/include/DB/Dictionaries/CacheDictionary.h
浏览文件 @
fbb0a3e7
...
@@ -79,9 +79,9 @@ public:
...
@@ -79,9 +79,9 @@ public:
void
toParent
(
const
PaddedPODArray
<
Key
>
&
ids
,
PaddedPODArray
<
Key
>
&
out
)
const
override
;
void
toParent
(
const
PaddedPODArray
<
Key
>
&
ids
,
PaddedPODArray
<
Key
>
&
out
)
const
override
;
/* void isIn(const PaddedPODArray<Key> & child_ids, const PaddedPODArray<Key> & ancestor_ids, PaddedPODArray<UInt8> & out) const override;
/* void isIn
VectorVector
(const PaddedPODArray<Key> & child_ids, const PaddedPODArray<Key> & ancestor_ids, PaddedPODArray<UInt8> & out) const override;
void isIn(const PaddedPODArray<Key> & child_ids, const Key ancestor_id, PaddedPODArray<UInt8> & out) const override;
void isIn
VectorConstant
(const PaddedPODArray<Key> & child_ids, const Key ancestor_id, PaddedPODArray<UInt8> & out) const override;
void isIn
(const Key child_id, const PaddedPODArray<Key> & ancestor_ids, PaddedPODArray<UInt8> & out) const override;
*/
void isIn
ConstantVector(const Key child_id, const PaddedPODArray<Key> & ancestor_ids, PaddedPODArray<UInt8> & out) const override;
*/
#define DECLARE(TYPE)\
#define DECLARE(TYPE)\
void get##TYPE(const std::string & attribute_name, const PaddedPODArray<Key> & ids, PaddedPODArray<TYPE> & out) const;
void get##TYPE(const std::string & attribute_name, const PaddedPODArray<Key> & ids, PaddedPODArray<TYPE> & out) const;
...
...
dbms/include/DB/Dictionaries/FlatDictionary.h
浏览文件 @
fbb0a3e7
...
@@ -63,9 +63,9 @@ public:
...
@@ -63,9 +63,9 @@ public:
void
toParent
(
const
PaddedPODArray
<
Key
>
&
ids
,
PaddedPODArray
<
Key
>
&
out
)
const
override
;
void
toParent
(
const
PaddedPODArray
<
Key
>
&
ids
,
PaddedPODArray
<
Key
>
&
out
)
const
override
;
void
isIn
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
void
isIn
VectorVector
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
void
isIn
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
Key
ancestor_id
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
void
isIn
VectorConstant
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
Key
ancestor_id
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
void
isIn
(
const
Key
child_id
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
void
isIn
ConstantVector
(
const
Key
child_id
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
#define DECLARE(TYPE)\
#define DECLARE(TYPE)\
void get##TYPE(const std::string & attribute_name, const PaddedPODArray<Key> & ids, PaddedPODArray<TYPE> & out) const;
void get##TYPE(const std::string & attribute_name, const PaddedPODArray<Key> & ids, PaddedPODArray<TYPE> & out) const;
...
...
dbms/include/DB/Dictionaries/HashedDictionary.h
浏览文件 @
fbb0a3e7
...
@@ -119,9 +119,9 @@ public:
...
@@ -119,9 +119,9 @@ public:
void
has
(
const
PaddedPODArray
<
Key
>
&
ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
void
has
(
const
PaddedPODArray
<
Key
>
&
ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
void
isIn
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
void
isIn
VectorVector
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
void
isIn
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
Key
ancestor_id
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
void
isIn
VectorConstant
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
Key
ancestor_id
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
void
isIn
(
const
Key
child_id
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
void
isIn
ConstantVector
(
const
Key
child_id
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
override
;
private:
private:
template
<
typename
Value
>
using
CollectionType
=
HashMap
<
UInt64
,
Value
>
;
template
<
typename
Value
>
using
CollectionType
=
HashMap
<
UInt64
,
Value
>
;
...
...
dbms/include/DB/Dictionaries/IDictionary.h
浏览文件 @
fbb0a3e7
...
@@ -67,25 +67,25 @@ struct IDictionary : IDictionaryBase
...
@@ -67,25 +67,25 @@ struct IDictionary : IDictionaryBase
/// Methods for hierarchy.
/// Methods for hierarchy.
virtual
void
isIn
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
virtual
void
isIn
VectorVector
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
{
{
throw
Exception
(
"Hierarchy is not supported for "
+
getName
()
+
" dictionary."
,
ErrorCodes
::
NOT_IMPLEMENTED
);
throw
Exception
(
"Hierarchy is not supported for "
+
getName
()
+
" dictionary."
,
ErrorCodes
::
NOT_IMPLEMENTED
);
}
}
virtual
void
isIn
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
Key
ancestor_id
,
PaddedPODArray
<
UInt8
>
&
out
)
const
virtual
void
isIn
VectorConstant
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
Key
ancestor_id
,
PaddedPODArray
<
UInt8
>
&
out
)
const
{
{
throw
Exception
(
"Hierarchy is not supported for "
+
getName
()
+
" dictionary."
,
ErrorCodes
::
NOT_IMPLEMENTED
);
throw
Exception
(
"Hierarchy is not supported for "
+
getName
()
+
" dictionary."
,
ErrorCodes
::
NOT_IMPLEMENTED
);
}
}
virtual
void
isIn
(
const
Key
child_id
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
virtual
void
isIn
ConstantVector
(
const
Key
child_id
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
{
{
throw
Exception
(
"Hierarchy is not supported for "
+
getName
()
+
" dictionary."
,
ErrorCodes
::
NOT_IMPLEMENTED
);
throw
Exception
(
"Hierarchy is not supported for "
+
getName
()
+
" dictionary."
,
ErrorCodes
::
NOT_IMPLEMENTED
);
}
}
v
irtual
void
isIn
(
const
Key
child_id
,
const
Key
ancestor_id
,
UInt8
&
out
)
const
v
oid
isInConstantConstant
(
const
Key
child_id
,
const
Key
ancestor_id
,
UInt8
&
out
)
const
{
{
PaddedPODArray
<
UInt8
>
out_arr
(
1
);
PaddedPODArray
<
UInt8
>
out_arr
(
1
);
isIn
(
PaddedPODArray
<
Key
>
(
1
,
child_id
),
PaddedPODArray
<
Key
>
(
1
,
ancestor_id
)
,
out_arr
);
isIn
VectorConstant
(
PaddedPODArray
<
Key
>
(
1
,
child_id
),
ancestor_id
,
out_arr
);
out
=
out_arr
[
0
];
out
=
out_arr
[
0
];
}
}
};
};
...
...
dbms/include/DB/Functions/FunctionsDictionaries.h
浏览文件 @
fbb0a3e7
...
@@ -831,7 +831,7 @@ private:
...
@@ -831,7 +831,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatchSimple
(
bool
executeDispatchSimple
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -872,7 +872,7 @@ private:
...
@@ -872,7 +872,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatchComplex
(
bool
executeDispatchComplex
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -997,7 +997,7 @@ private:
...
@@ -997,7 +997,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatch
(
bool
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -1045,7 +1045,7 @@ private:
...
@@ -1045,7 +1045,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatchComplex
(
bool
executeDispatchComplex
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -1092,7 +1092,7 @@ private:
...
@@ -1092,7 +1092,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatchRange
(
bool
executeDispatchRange
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -1130,8 +1130,8 @@ private:
...
@@ -1130,8 +1130,8 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
void
executeRange
(
void
executeRange
(
Block
&
block
,
const
size_t
result
,
const
DictionaryType
*
const
dictionary
,
const
std
::
string
&
attr_name
,
Block
&
block
,
const
size_t
result
,
const
DictionaryType
*
dictionary
,
const
std
::
string
&
attr_name
,
const
ColumnUInt64
*
const
id_col
,
const
IColumn
*
const
date_col_untyped
)
const
ColumnUInt64
*
id_col
,
const
IColumn
*
date_col_untyped
)
{
{
if
(
const
auto
date_col
=
typeid_cast
<
const
ColumnUInt16
*>
(
date_col_untyped
))
if
(
const
auto
date_col
=
typeid_cast
<
const
ColumnUInt16
*>
(
date_col_untyped
))
{
{
...
@@ -1157,8 +1157,8 @@ private:
...
@@ -1157,8 +1157,8 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
void
executeRange
(
void
executeRange
(
Block
&
block
,
const
size_t
result
,
const
DictionaryType
*
const
dictionary
,
const
std
::
string
&
attr_name
,
Block
&
block
,
const
size_t
result
,
const
DictionaryType
*
dictionary
,
const
std
::
string
&
attr_name
,
const
ColumnConst
<
UInt64
>
*
const
id_col
,
const
IColumn
*
const
date_col_untyped
)
const
ColumnConst
<
UInt64
>
*
id_col
,
const
IColumn
*
date_col_untyped
)
{
{
if
(
const
auto
date_col
=
typeid_cast
<
const
ColumnUInt16
*>
(
date_col_untyped
))
if
(
const
auto
date_col
=
typeid_cast
<
const
ColumnUInt16
*>
(
date_col_untyped
))
{
{
...
@@ -1267,7 +1267,7 @@ private:
...
@@ -1267,7 +1267,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatch
(
bool
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -1302,8 +1302,8 @@ private:
...
@@ -1302,8 +1302,8 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
void
executeDispatch
(
void
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
DictionaryType
*
const
dictionary
,
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
DictionaryType
*
dictionary
,
const
std
::
string
&
attr_name
,
const
ColumnUInt64
*
const
id_col
)
const
std
::
string
&
attr_name
,
const
ColumnUInt64
*
id_col
)
{
{
const
auto
default_col_untyped
=
block
.
getByPosition
(
arguments
[
3
]).
column
.
get
();
const
auto
default_col_untyped
=
block
.
getByPosition
(
arguments
[
3
]).
column
.
get
();
...
@@ -1336,8 +1336,8 @@ private:
...
@@ -1336,8 +1336,8 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
void
executeDispatch
(
void
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
DictionaryType
*
const
dictionary
,
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
DictionaryType
*
dictionary
,
const
std
::
string
&
attr_name
,
const
ColumnConst
<
UInt64
>
*
const
id_col
)
const
std
::
string
&
attr_name
,
const
ColumnConst
<
UInt64
>
*
id_col
)
{
{
const
auto
default_col_untyped
=
block
.
getByPosition
(
arguments
[
3
]).
column
.
get
();
const
auto
default_col_untyped
=
block
.
getByPosition
(
arguments
[
3
]).
column
.
get
();
...
@@ -1372,7 +1372,7 @@ private:
...
@@ -1372,7 +1372,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatchComplex
(
bool
executeDispatchComplex
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -1433,35 +1433,35 @@ template <> struct DictGetTraits<DATA_TYPE>\
...
@@ -1433,35 +1433,35 @@ template <> struct DictGetTraits<DATA_TYPE>\
{\
{\
template <typename DictionaryType>\
template <typename DictionaryType>\
static void get(\
static void get(\
const DictionaryType *
const
dict, const std::string & name, const PaddedPODArray<UInt64> & ids,\
const DictionaryType * dict, const std::string & name, const PaddedPODArray<UInt64> & ids,\
PaddedPODArray<TYPE> & out)\
PaddedPODArray<TYPE> & out)\
{\
{\
dict->get##TYPE(name, ids, out);\
dict->get##TYPE(name, ids, out);\
}\
}\
template <typename DictionaryType>\
template <typename DictionaryType>\
static void get(\
static void get(\
const DictionaryType *
const
dict, const std::string & name, const ConstColumnPlainPtrs & key_columns,\
const DictionaryType * dict, const std::string & name, const ConstColumnPlainPtrs & key_columns,\
const DataTypes & key_types, PaddedPODArray<TYPE> & out)\
const DataTypes & key_types, PaddedPODArray<TYPE> & out)\
{\
{\
dict->get##TYPE(name, key_columns, key_types, out);\
dict->get##TYPE(name, key_columns, key_types, out);\
}\
}\
template <typename DictionaryType>\
template <typename DictionaryType>\
static void get(\
static void get(\
const DictionaryType *
const
dict, const std::string & name, const PaddedPODArray<UInt64> & ids,\
const DictionaryType * dict, const std::string & name, const PaddedPODArray<UInt64> & ids,\
const PaddedPODArray<UInt16> & dates, PaddedPODArray<TYPE> & out)\
const PaddedPODArray<UInt16> & dates, PaddedPODArray<TYPE> & out)\
{\
{\
dict->get##TYPE(name, ids, dates, out);\
dict->get##TYPE(name, ids, dates, out);\
}\
}\
template <typename DictionaryType, typename DefaultsType>\
template <typename DictionaryType, typename DefaultsType>\
static void getOrDefault(\
static void getOrDefault(\
const DictionaryType *
const
dict, const std::string & name, const PaddedPODArray<UInt64> & ids,\
const DictionaryType * dict, const std::string & name, const PaddedPODArray<UInt64> & ids,\
const DefaultsType & def, PaddedPODArray<TYPE> & out)\
const DefaultsType & def, PaddedPODArray<TYPE> & out)\
{\
{\
dict->get##TYPE(name, ids, def, out);\
dict->get##TYPE(name, ids, def, out);\
}\
}\
template <typename DictionaryType, typename DefaultsType>\
template <typename DictionaryType, typename DefaultsType>\
static void getOrDefault(\
static void getOrDefault(\
const DictionaryType *
const
dict, const std::string & name, const ConstColumnPlainPtrs & key_columns,\
const DictionaryType * dict, const std::string & name, const ConstColumnPlainPtrs & key_columns,\
const DataTypes & key_types, const DefaultsType & def, PaddedPODArray<TYPE> & out)\
const DataTypes & key_types, const DefaultsType & def, PaddedPODArray<TYPE> & out)\
{\
{\
dict->get##TYPE(name, key_columns, key_types, def, out);\
dict->get##TYPE(name, key_columns, key_types, def, out);\
...
@@ -1567,7 +1567,7 @@ private:
...
@@ -1567,7 +1567,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
bool
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -1618,7 +1618,7 @@ private:
...
@@ -1618,7 +1618,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatchComplex
(
bool
executeDispatchComplex
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -1667,7 +1667,7 @@ private:
...
@@ -1667,7 +1667,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatchRange
(
bool
executeDispatchRange
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -1705,8 +1705,8 @@ private:
...
@@ -1705,8 +1705,8 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
void
executeRange
(
void
executeRange
(
Block
&
block
,
const
size_t
result
,
const
DictionaryType
*
const
dictionary
,
const
std
::
string
&
attr_name
,
Block
&
block
,
const
size_t
result
,
const
DictionaryType
*
dictionary
,
const
std
::
string
&
attr_name
,
const
ColumnUInt64
*
const
id_col
,
const
IColumn
*
const
date_col_untyped
)
const
ColumnUInt64
*
id_col
,
const
IColumn
*
date_col_untyped
)
{
{
if
(
const
auto
date_col
=
typeid_cast
<
const
ColumnUInt16
*>
(
date_col_untyped
))
if
(
const
auto
date_col
=
typeid_cast
<
const
ColumnUInt16
*>
(
date_col_untyped
))
{
{
...
@@ -1742,8 +1742,8 @@ private:
...
@@ -1742,8 +1742,8 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
void
executeRange
(
void
executeRange
(
Block
&
block
,
const
size_t
result
,
const
DictionaryType
*
const
dictionary
,
const
std
::
string
&
attr_name
,
Block
&
block
,
const
size_t
result
,
const
DictionaryType
*
dictionary
,
const
std
::
string
&
attr_name
,
const
ColumnConst
<
UInt64
>
*
const
id_col
,
const
IColumn
*
const
date_col_untyped
)
const
ColumnConst
<
UInt64
>
*
id_col
,
const
IColumn
*
date_col_untyped
)
{
{
if
(
const
auto
date_col
=
typeid_cast
<
const
ColumnUInt16
*>
(
date_col_untyped
))
if
(
const
auto
date_col
=
typeid_cast
<
const
ColumnUInt16
*>
(
date_col_untyped
))
{
{
...
@@ -1880,7 +1880,7 @@ private:
...
@@ -1880,7 +1880,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
bool
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -1915,8 +1915,8 @@ private:
...
@@ -1915,8 +1915,8 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
void
executeDispatch
(
void
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
DictionaryType
*
const
dictionary
,
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
DictionaryType
*
dictionary
,
const
std
::
string
&
attr_name
,
const
ColumnUInt64
*
const
id_col
)
const
std
::
string
&
attr_name
,
const
ColumnUInt64
*
id_col
)
{
{
const
auto
default_col_untyped
=
block
.
getByPosition
(
arguments
[
3
]).
column
.
get
();
const
auto
default_col_untyped
=
block
.
getByPosition
(
arguments
[
3
]).
column
.
get
();
...
@@ -1952,8 +1952,8 @@ private:
...
@@ -1952,8 +1952,8 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
void
executeDispatch
(
void
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
DictionaryType
*
const
dictionary
,
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
DictionaryType
*
dictionary
,
const
std
::
string
&
attr_name
,
const
ColumnConst
<
UInt64
>
*
const
id_col
)
const
std
::
string
&
attr_name
,
const
ColumnConst
<
UInt64
>
*
id_col
)
{
{
const
auto
default_col_untyped
=
block
.
getByPosition
(
arguments
[
3
]).
column
.
get
();
const
auto
default_col_untyped
=
block
.
getByPosition
(
arguments
[
3
]).
column
.
get
();
...
@@ -1990,7 +1990,7 @@ private:
...
@@ -1990,7 +1990,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatchComplex
(
bool
executeDispatchComplex
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -2132,7 +2132,7 @@ private:
...
@@ -2132,7 +2132,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
bool
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -2303,7 +2303,7 @@ private:
...
@@ -2303,7 +2303,7 @@ private:
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
bool
executeDispatch
(
Block
&
block
,
const
ColumnNumbers
&
arguments
,
const
size_t
result
,
const
IDictionaryBase
*
const
dictionary
)
const
IDictionaryBase
*
dictionary
)
{
{
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
const
auto
dict
=
typeid_cast
<
const
DictionaryType
*>
(
dictionary
);
if
(
!
dict
)
if
(
!
dict
)
...
@@ -2331,8 +2331,8 @@ private:
...
@@ -2331,8 +2331,8 @@ private:
}
}
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
execute
(
Block
&
block
,
const
size_t
result
,
const
DictionaryType
*
const
dictionary
,
bool
execute
(
Block
&
block
,
const
size_t
result
,
const
DictionaryType
*
dictionary
,
const
ColumnUInt64
*
c
onst
child_id_col
,
const
IColumn
*
const
ancestor_id_col_untyped
)
const
ColumnUInt64
*
c
hild_id_col
,
const
IColumn
*
ancestor_id_col_untyped
)
{
{
if
(
const
auto
ancestor_id_col
=
typeid_cast
<
const
ColumnUInt64
*>
(
ancestor_id_col_untyped
))
if
(
const
auto
ancestor_id_col
=
typeid_cast
<
const
ColumnUInt64
*>
(
ancestor_id_col_untyped
))
{
{
...
@@ -2345,7 +2345,7 @@ private:
...
@@ -2345,7 +2345,7 @@ private:
const
auto
size
=
child_id_col
->
size
();
const
auto
size
=
child_id_col
->
size
();
data
.
resize
(
size
);
data
.
resize
(
size
);
dictionary
->
isIn
(
child_ids
,
ancestor_ids
,
data
);
dictionary
->
isIn
VectorVector
(
child_ids
,
ancestor_ids
,
data
);
}
}
else
if
(
const
auto
ancestor_id_col
=
typeid_cast
<
const
ColumnConst
<
UInt64
>
*>
(
ancestor_id_col_untyped
))
else
if
(
const
auto
ancestor_id_col
=
typeid_cast
<
const
ColumnConst
<
UInt64
>
*>
(
ancestor_id_col_untyped
))
{
{
...
@@ -2358,7 +2358,7 @@ private:
...
@@ -2358,7 +2358,7 @@ private:
const
auto
size
=
child_id_col
->
size
();
const
auto
size
=
child_id_col
->
size
();
data
.
resize
(
size
);
data
.
resize
(
size
);
dictionary
->
isIn
(
child_ids
,
ancestor_id
,
data
);
dictionary
->
isIn
VectorConstant
(
child_ids
,
ancestor_id
,
data
);
}
}
else
else
{
{
...
@@ -2372,8 +2372,8 @@ private:
...
@@ -2372,8 +2372,8 @@ private:
}
}
template
<
typename
DictionaryType
>
template
<
typename
DictionaryType
>
bool
execute
(
Block
&
block
,
const
size_t
result
,
const
DictionaryType
*
const
dictionary
,
bool
execute
(
Block
&
block
,
const
size_t
result
,
const
DictionaryType
*
dictionary
,
const
ColumnConst
<
UInt64
>
*
c
onst
child_id_col
,
const
IColumn
*
const
ancestor_id_col_untyped
)
const
ColumnConst
<
UInt64
>
*
c
hild_id_col
,
const
IColumn
*
ancestor_id_col_untyped
)
{
{
if
(
const
auto
ancestor_id_col
=
typeid_cast
<
const
ColumnUInt64
*>
(
ancestor_id_col_untyped
))
if
(
const
auto
ancestor_id_col
=
typeid_cast
<
const
ColumnUInt64
*>
(
ancestor_id_col_untyped
))
{
{
...
@@ -2386,12 +2386,15 @@ private:
...
@@ -2386,12 +2386,15 @@ private:
const
auto
size
=
child_id_col
->
size
();
const
auto
size
=
child_id_col
->
size
();
data
.
resize
(
size
);
data
.
resize
(
size
);
dictionary
->
isIn
(
child_id
,
ancestor_ids
,
data
);
dictionary
->
isIn
ConstantVector
(
child_id
,
ancestor_ids
,
data
);
}
}
else
if
(
const
auto
ancestor_id_col
=
typeid_cast
<
const
ColumnConst
<
UInt64
>
*>
(
ancestor_id_col_untyped
))
else
if
(
const
auto
ancestor_id_col
=
typeid_cast
<
const
ColumnConst
<
UInt64
>
*>
(
ancestor_id_col_untyped
))
{
{
const
auto
child_id
=
child_id_col
->
getData
();
const
auto
ancestor_id
=
ancestor_id_col
->
getData
();
UInt8
res
=
0
;
UInt8
res
=
0
;
dictionary
->
isIn
(
child_id_col
->
getData
(),
ancestor_id_col
->
getData
(),
res
);
dictionary
->
isInConstantConstant
(
child_id
,
ancestor_id
,
res
);
block
.
getByPosition
(
result
).
column
=
std
::
make_shared
<
ColumnConst
<
UInt8
>>
(
block
.
getByPosition
(
result
).
column
=
std
::
make_shared
<
ColumnConst
<
UInt8
>>
(
child_id_col
->
size
(),
res
);
child_id_col
->
size
(),
res
);
...
...
dbms/src/Dictionaries/CacheDictionary.cpp
浏览文件 @
fbb0a3e7
...
@@ -54,6 +54,22 @@ void CacheDictionary::toParent(const PaddedPODArray<Key> & ids, PaddedPODArray<K
...
@@ -54,6 +54,22 @@ void CacheDictionary::toParent(const PaddedPODArray<Key> & ids, PaddedPODArray<K
}
}
/*void CacheDictionary::isIn(
const PaddedPODArray<Key> & child_ids,
const PaddedPODArray<Key> & ancestor_ids,
PaddedPODArray<UInt8> & out) const
{
memset(out.data(), 0, out.size() * sizeof(out[0]));
const PaddedPODArray<Key> * current_child_ids = &child_ids;
PaddedPODArray<Key> child_ids_buffer;
PaddedPODArray<Key> parents(out.size());
toParent(*current_child_ids, parents);
for (size_t i = 0,)
}*/
#define DECLARE(TYPE)\
#define DECLARE(TYPE)\
void CacheDictionary::get##TYPE(const std::string & attribute_name, const PaddedPODArray<Key> & ids, PaddedPODArray<TYPE> & out) const\
void CacheDictionary::get##TYPE(const std::string & attribute_name, const PaddedPODArray<Key> & ids, PaddedPODArray<TYPE> & out) const\
{\
{\
...
...
dbms/src/Dictionaries/FlatDictionary.cpp
浏览文件 @
fbb0a3e7
...
@@ -87,7 +87,7 @@ void FlatDictionary::isInImpl(
...
@@ -87,7 +87,7 @@ void FlatDictionary::isInImpl(
}
}
void
FlatDictionary
::
isIn
(
void
FlatDictionary
::
isIn
VectorVector
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
PaddedPODArray
<
UInt8
>
&
out
)
const
...
@@ -95,7 +95,7 @@ void FlatDictionary::isIn(
...
@@ -95,7 +95,7 @@ void FlatDictionary::isIn(
isInImpl
(
child_ids
,
ancestor_ids
,
out
);
isInImpl
(
child_ids
,
ancestor_ids
,
out
);
}
}
void
FlatDictionary
::
isIn
(
void
FlatDictionary
::
isIn
VectorConstant
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
Key
ancestor_id
,
const
Key
ancestor_id
,
PaddedPODArray
<
UInt8
>
&
out
)
const
PaddedPODArray
<
UInt8
>
&
out
)
const
...
@@ -103,7 +103,7 @@ void FlatDictionary::isIn(
...
@@ -103,7 +103,7 @@ void FlatDictionary::isIn(
isInImpl
(
child_ids
,
ancestor_id
,
out
);
isInImpl
(
child_ids
,
ancestor_id
,
out
);
}
}
void
FlatDictionary
::
isIn
(
void
FlatDictionary
::
isIn
ConstantVector
(
const
Key
child_id
,
const
Key
child_id
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
PaddedPODArray
<
UInt8
>
&
out
)
const
...
...
dbms/src/Dictionaries/HashedDictionary.cpp
浏览文件 @
fbb0a3e7
...
@@ -84,7 +84,7 @@ void HashedDictionary::isInImpl(
...
@@ -84,7 +84,7 @@ void HashedDictionary::isInImpl(
query_count
.
fetch_add
(
rows
,
std
::
memory_order_relaxed
);
query_count
.
fetch_add
(
rows
,
std
::
memory_order_relaxed
);
}
}
void
HashedDictionary
::
isIn
(
void
HashedDictionary
::
isIn
VectorVector
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
PaddedPODArray
<
UInt8
>
&
out
)
const
...
@@ -92,7 +92,7 @@ void HashedDictionary::isIn(
...
@@ -92,7 +92,7 @@ void HashedDictionary::isIn(
isInImpl
(
child_ids
,
ancestor_ids
,
out
);
isInImpl
(
child_ids
,
ancestor_ids
,
out
);
}
}
void
HashedDictionary
::
isIn
(
void
HashedDictionary
::
isIn
VectorConstant
(
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
PaddedPODArray
<
Key
>
&
child_ids
,
const
Key
ancestor_id
,
const
Key
ancestor_id
,
PaddedPODArray
<
UInt8
>
&
out
)
const
PaddedPODArray
<
UInt8
>
&
out
)
const
...
@@ -100,7 +100,7 @@ void HashedDictionary::isIn(
...
@@ -100,7 +100,7 @@ void HashedDictionary::isIn(
isInImpl
(
child_ids
,
ancestor_id
,
out
);
isInImpl
(
child_ids
,
ancestor_id
,
out
);
}
}
void
HashedDictionary
::
isIn
(
void
HashedDictionary
::
isIn
ConstantVector
(
const
Key
child_id
,
const
Key
child_id
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
const
PaddedPODArray
<
Key
>
&
ancestor_ids
,
PaddedPODArray
<
UInt8
>
&
out
)
const
PaddedPODArray
<
UInt8
>
&
out
)
const
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录