Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
e4ba3a67
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,发现更多精彩内容 >>
提交
e4ba3a67
编写于
5月 03, 2019
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed bad code
上级
0a072ccc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
14 addition
and
12 deletion
+14
-12
dbms/src/Storages/AlterCommands.cpp
dbms/src/Storages/AlterCommands.cpp
+6
-5
dbms/src/Storages/AlterCommands.h
dbms/src/Storages/AlterCommands.h
+5
-4
dbms/src/Storages/IStorage.cpp
dbms/src/Storages/IStorage.cpp
+1
-1
dbms/src/Storages/MergeTree/MergeTreeData.cpp
dbms/src/Storages/MergeTree/MergeTreeData.cpp
+1
-1
dbms/src/Storages/StorageMergeTree.cpp
dbms/src/Storages/StorageMergeTree.cpp
+1
-1
未找到文件。
dbms/src/Storages/AlterCommands.cpp
浏览文件 @
e4ba3a67
...
...
@@ -214,7 +214,7 @@ void AlterCommand::apply(ColumnsDescription & columns_description, IndicesDescri
column
.
codec
=
codec
;
}
if
(
!
is
_m
utable
())
if
(
!
is
M
utable
())
{
column
.
comment
=
comment
;
return
;
...
...
@@ -306,7 +306,7 @@ void AlterCommand::apply(ColumnsDescription & columns_description, IndicesDescri
throw
Exception
(
"Wrong parameter type in ALTER query"
,
ErrorCodes
::
LOGICAL_ERROR
);
}
bool
AlterCommand
::
is
_m
utable
()
const
bool
AlterCommand
::
is
M
utable
()
const
{
if
(
type
==
COMMENT_COLUMN
)
return
false
;
...
...
@@ -328,6 +328,7 @@ void AlterCommands::apply(ColumnsDescription & columns_description, IndicesDescr
for
(
const
AlterCommand
&
command
:
*
this
)
if
(
!
command
.
ignore
)
command
.
apply
(
new_columns_description
,
new_indices_description
,
new_order_by_ast
,
new_primary_key_ast
,
new_ttl_table_ast
);
columns_description
=
std
::
move
(
new_columns_description
);
indices_description
=
std
::
move
(
new_indices_description
);
order_by_ast
=
std
::
move
(
new_order_by_ast
);
...
...
@@ -495,7 +496,7 @@ void AlterCommands::validate(const IStorage & table, const Context & context)
/// column has no associated alter command, let's create it
/// add a new alter command to modify existing column
this
->
emplace_back
(
AlterCommand
{
AlterCommand
::
MODIFY_COLUMN
,
column
.
name
,
explicit_type
,
column
.
default_desc
.
kind
,
column
.
default_desc
.
expression
});
column
.
name
,
explicit_type
,
column
.
default_desc
.
kind
,
column
.
default_desc
.
expression
,
{},
{},
{},
{}
});
command
=
&
back
();
}
...
...
@@ -534,11 +535,11 @@ void AlterCommands::apply(ColumnsDescription & columns_description) const
columns_description
=
std
::
move
(
out_columns_description
);
}
bool
AlterCommands
::
is
_m
utable
()
const
bool
AlterCommands
::
is
M
utable
()
const
{
for
(
const
auto
&
param
:
*
this
)
{
if
(
param
.
is
_m
utable
())
if
(
param
.
is
M
utable
())
return
true
;
}
...
...
dbms/src/Storages/AlterCommands.h
浏览文件 @
e4ba3a67
...
...
@@ -73,8 +73,8 @@ struct AlterCommand
AlterCommand
()
=
default
;
AlterCommand
(
const
Type
type
,
const
String
&
column_name
,
const
DataTypePtr
&
data_type
,
const
ColumnDefaultKind
default_kind
,
const
ASTPtr
&
default_expression
,
const
String
&
after_column
=
String
{},
const
String
&
comment
=
""
,
const
bool
if_exists
=
false
,
const
bool
if_not_exists
=
false
)
// TODO: разобраться здесь с параметром по умолчанию
const
String
&
after_column
,
const
String
&
comment
,
const
bool
if_exists
,
const
bool
if_not_exists
)
:
type
{
type
},
column_name
{
column_name
},
data_type
{
data_type
},
default_kind
{
default_kind
},
default_expression
{
default_expression
},
comment
(
comment
),
after_column
{
after_column
},
if_exists
(
if_exists
),
if_not_exists
(
if_not_exists
)
...
...
@@ -84,8 +84,9 @@ struct AlterCommand
void
apply
(
ColumnsDescription
&
columns_description
,
IndicesDescription
&
indices_description
,
ASTPtr
&
order_by_ast
,
ASTPtr
&
primary_key_ast
,
ASTPtr
&
ttl_table_ast
)
const
;
/// Checks that not only metadata touched by that command
bool
is
_m
utable
()
const
;
bool
is
M
utable
()
const
;
};
class
IStorage
;
...
...
@@ -101,7 +102,7 @@ public:
void
apply
(
ColumnsDescription
&
columns_description
)
const
;
void
validate
(
const
IStorage
&
table
,
const
Context
&
context
);
bool
is
_m
utable
()
const
;
bool
is
M
utable
()
const
;
};
}
dbms/src/Storages/IStorage.cpp
浏览文件 @
e4ba3a67
...
...
@@ -9,7 +9,7 @@ void IStorage::alter(const AlterCommands & params, const String & database_name,
{
for
(
const
auto
&
param
:
params
)
{
if
(
param
.
is
_m
utable
())
if
(
param
.
is
M
utable
())
throw
Exception
(
"Method alter supports only change comment of column for storage "
+
getName
(),
ErrorCodes
::
NOT_IMPLEMENTED
);
}
...
...
dbms/src/Storages/MergeTree/MergeTreeData.cpp
浏览文件 @
e4ba3a67
...
...
@@ -1233,7 +1233,7 @@ void MergeTreeData::checkAlter(const AlterCommands & commands, const Context & c
for
(
const
AlterCommand
&
command
:
commands
)
{
if
(
!
command
.
is
_m
utable
())
if
(
!
command
.
is
M
utable
())
{
continue
;
}
...
...
dbms/src/Storages/StorageMergeTree.cpp
浏览文件 @
e4ba3a67
...
...
@@ -200,7 +200,7 @@ void StorageMergeTree::alter(
const
Context
&
context
,
TableStructureWriteLockHolder
&
table_lock_holder
)
{
if
(
!
params
.
is
_m
utable
())
if
(
!
params
.
is
M
utable
())
{
lockStructureExclusively
(
table_lock_holder
,
context
.
getCurrentQueryId
());
auto
new_columns
=
getColumns
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录