Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
2219f051
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,发现更多精彩内容 >>
未验证
提交
2219f051
编写于
4月 14, 2020
作者:
A
alexey-milovidov
提交者:
GitHub
4月 14, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10235 from ClickHouse/fix_range_hashed_ddl_dictionaries
Fix 'Cannot add column' in DDL dictionary
上级
7c6a0c27
9cc7d0f0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
52 addition
and
1 deletion
+52
-1
src/Storages/StorageDictionary.cpp
src/Storages/StorageDictionary.cpp
+15
-1
tests/queries/0_stateless/01125_dict_ddl_cannot_add_column.reference
...es/0_stateless/01125_dict_ddl_cannot_add_column.reference
+3
-0
tests/queries/0_stateless/01125_dict_ddl_cannot_add_column.sql
.../queries/0_stateless/01125_dict_ddl_cannot_add_column.sql
+34
-0
未找到文件。
src/Storages/StorageDictionary.cpp
浏览文件 @
2219f051
...
...
@@ -75,16 +75,30 @@ NamesAndTypesList StorageDictionary::getNamesAndTypes(const DictionaryStructure
if
(
dictionary_structure
.
id
)
dictionary_names_and_types
.
emplace_back
(
dictionary_structure
.
id
->
name
,
std
::
make_shared
<
DataTypeUInt64
>
());
/// In old-style (XML) configuration we don't have this attributes in the
/// main attribute list, so we have to add them to columns list explicitly.
/// In the new configuration (DDL) we have them both in range_* nodes and
/// main attribute list, but for compatibility we add them before main
/// attributes list.
if
(
dictionary_structure
.
range_min
)
dictionary_names_and_types
.
emplace_back
(
dictionary_structure
.
range_min
->
name
,
dictionary_structure
.
range_min
->
type
);
if
(
dictionary_structure
.
range_max
)
dictionary_names_and_types
.
emplace_back
(
dictionary_structure
.
range_max
->
name
,
dictionary_structure
.
range_max
->
type
);
if
(
dictionary_structure
.
key
)
{
for
(
const
auto
&
attribute
:
*
dictionary_structure
.
key
)
dictionary_names_and_types
.
emplace_back
(
attribute
.
name
,
attribute
.
type
);
}
for
(
const
auto
&
attribute
:
dictionary_structure
.
attributes
)
dictionary_names_and_types
.
emplace_back
(
attribute
.
name
,
attribute
.
type
);
{
/// Some attributes can be already added (range_min and range_max)
if
(
!
dictionary_names_and_types
.
contains
(
attribute
.
name
))
dictionary_names_and_types
.
emplace_back
(
attribute
.
name
,
attribute
.
type
);
}
return
dictionary_names_and_types
;
}
...
...
tests/queries/0_stateless/01125_dict_ddl_cannot_add_column.reference
0 → 100644
浏览文件 @
2219f051
1 2019-01-05 2020-01-10 1
date_table
somedict
tests/queries/0_stateless/01125_dict_ddl_cannot_add_column.sql
0 → 100644
浏览文件 @
2219f051
DROP
DATABASE
IF
EXISTS
database_for_dict
;
CREATE
DATABASE
database_for_dict
;
use
database_for_dict
;
CREATE
TABLE
date_table
(
id
UInt32
,
val
String
,
start
Date
,
end
Date
)
Engine
=
Memory
();
INSERT
INTO
date_table
VALUES
(
1
,
'1'
,
toDate
(
'2019-01-05'
),
toDate
(
'2020-01-10'
));
CREATE
DICTIONARY
somedict
(
id
UInt32
,
val
String
,
start
Date
,
end
Date
)
PRIMARY
KEY
id
SOURCE
(
CLICKHOUSE
(
HOST
'localhost'
PORT
9000
USER
'default'
TABLE
'date_table'
DB
'database_for_dict'
))
LAYOUT
(
RANGE_HASHED
())
RANGE
(
MIN
start
MAX
end
)
LIFETIME
(
MIN
300
MAX
360
);
SELECT
*
from
somedict
;
SHOW
TABLES
;
DROP
DATABASE
IF
EXISTS
database_for_dict
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录