Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
5dddee50
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,发现更多精彩内容 >>
提交
5dddee50
编写于
3月 29, 2019
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:yandex/ClickHouse
上级
ff0c2698
296731dd
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
26 addition
and
18 deletion
+26
-18
dbms/src/Columns/ColumnLowCardinality.cpp
dbms/src/Columns/ColumnLowCardinality.cpp
+1
-11
dbms/src/Columns/ColumnLowCardinality.h
dbms/src/Columns/ColumnLowCardinality.h
+2
-4
dbms/src/DataTypes/DataTypeLowCardinality.cpp
dbms/src/DataTypes/DataTypeLowCardinality.cpp
+16
-3
dbms/tests/queries/0_stateless/00931_low_cardinality_read_with_empty_array.reference
...ess/00931_low_cardinality_read_with_empty_array.reference
+0
-0
dbms/tests/queries/0_stateless/00931_low_cardinality_read_with_empty_array.sql
...stateless/00931_low_cardinality_read_with_empty_array.sql
+7
-0
未找到文件。
dbms/src/Columns/ColumnLowCardinality.cpp
浏览文件 @
5dddee50
...
...
@@ -306,21 +306,11 @@ void ColumnLowCardinality::setSharedDictionary(const ColumnPtr & column_unique)
dictionary
.
setShared
(
column_unique
);
}
ColumnLowCardinality
::
MutablePtr
ColumnLowCardinality
::
compact
()
{
auto
positions
=
idx
.
getPositions
();
/// Create column with new indexes and old dictionary.
auto
column
=
ColumnLowCardinality
::
create
(
getDictionary
().
assumeMutable
(),
(
*
std
::
move
(
positions
)).
mutate
());
/// Will create new dictionary.
column
->
compactInplace
();
return
column
;
}
ColumnLowCardinality
::
MutablePtr
ColumnLowCardinality
::
cutAndCompact
(
size_t
start
,
size_t
length
)
const
{
auto
sub_positions
=
(
*
idx
.
getPositions
()
->
cut
(
start
,
length
)).
mutate
();
/// Create column with new indexes and old dictionary.
/// Dictionary is shared, but will be recreated after compactInplace call.
auto
column
=
ColumnLowCardinality
::
create
(
getDictionary
().
assumeMutable
(),
std
::
move
(
sub_positions
));
/// Will create new dictionary.
column
->
compactInplace
();
...
...
dbms/src/Columns/ColumnLowCardinality.h
浏览文件 @
5dddee50
...
...
@@ -177,10 +177,8 @@ public:
void
setSharedDictionary
(
const
ColumnPtr
&
column_unique
);
bool
isSharedDictionary
()
const
{
return
dictionary
.
isShared
();
}
/// Create column new dictionary with only keys that are mentioned in index.
MutablePtr
compact
();
/// Cut + compact.
/// Create column with new dictionary from column part.
/// Dictionary will have only keys that are mentioned in index.
MutablePtr
cutAndCompact
(
size_t
start
,
size_t
length
)
const
;
struct
DictionaryEncodedColumn
...
...
dbms/src/DataTypes/DataTypeLowCardinality.cpp
浏览文件 @
5dddee50
...
...
@@ -195,6 +195,12 @@ struct DeserializeStateLowCardinality : public IDataType::DeserializeBinaryBulkS
ColumnPtr
null_map
;
UInt64
num_pending_rows
=
0
;
/// If dictionary should be updated.
/// Can happen is some granules was skipped while reading from MergeTree.
/// We should store this flag in State because
/// in case of long block of empty arrays we may not need read dictionary at first reading.
bool
need_update_dictionary
=
false
;
explicit
DeserializeStateLowCardinality
(
UInt64
key_version
)
:
key_version
(
key_version
)
{}
};
...
...
@@ -686,7 +692,12 @@ void DataTypeLowCardinality::deserializeBinaryBulkWithMultipleStreams(
if
(
!
settings
.
continuous_reading
)
low_cardinality_state
->
num_pending_rows
=
0
;
bool
first_dictionary
=
true
;
if
(
!
settings
.
continuous_reading
)
{
/// Remember in state that some granules were skipped and we need to update dictionary.
low_cardinality_state
->
need_update_dictionary
=
true
;
}
while
(
limit
)
{
if
(
low_cardinality_state
->
num_pending_rows
==
0
)
...
...
@@ -699,10 +710,12 @@ void DataTypeLowCardinality::deserializeBinaryBulkWithMultipleStreams(
index_type
.
deserialize
(
*
indexes_stream
);
if
(
index_type
.
need_global_dictionary
&&
(
!
global_dictionary
||
index_type
.
need_update_dictionary
||
(
first_dictionary
&&
!
settings
.
continuous_reading
)))
bool
need_update_dictionary
=
!
global_dictionary
||
index_type
.
need_update_dictionary
||
low_cardinality_state
->
need_update_dictionary
;
if
(
index_type
.
need_global_dictionary
&&
need_update_dictionary
)
{
readDictionary
();
first
_dictionary
=
false
;
low_cardinality_state
->
need_update
_dictionary
=
false
;
}
if
(
low_cardinality_state
->
index_type
.
has_additional_keys
)
...
...
dbms/tests/queries/0_stateless/00931_low_cardinality_read_with_empty_array.reference
0 → 100644
浏览文件 @
5dddee50
dbms/tests/queries/0_stateless/00931_low_cardinality_read_with_empty_array.sql
0 → 100644
浏览文件 @
5dddee50
drop
table
if
exists
test
.
lc
;
create
table
test
.
lc
(
key
UInt64
,
value
Array
(
LowCardinality
(
String
)))
engine
=
MergeTree
order
by
key
;
insert
into
test
.
lc
select
number
,
if
(
number
<
10000
or
number
>
100000
,
[
toString
(
number
)],
emptyArrayString
())
from
system
.
numbers
limit
200000
;
select
*
from
test
.
lc
where
(
key
<
100
or
key
>
50000
)
and
not
has
(
value
,
toString
(
key
))
and
length
(
value
)
==
1
limit
10
settings
max_block_size
=
8192
,
max_threads
=
1
;
drop
table
if
exists
test
.
lc
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录