Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
a4c43e51
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,发现更多精彩内容 >>
提交
a4c43e51
编写于
9月 11, 2020
作者:
A
alesapin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a test
上级
a5f88998
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
87 addition
and
3 deletion
+87
-3
src/Parsers/ASTAlterQuery.cpp
src/Parsers/ASTAlterQuery.cpp
+1
-1
src/Parsers/ParserAlterQuery.cpp
src/Parsers/ParserAlterQuery.cpp
+11
-1
src/Storages/AlterCommands.cpp
src/Storages/AlterCommands.cpp
+0
-1
tests/queries/0_stateless/01493_alter_remove_properties.reference
...eries/0_stateless/01493_alter_remove_properties.reference
+17
-0
tests/queries/0_stateless/01493_alter_remove_properties.sql
tests/queries/0_stateless/01493_alter_remove_properties.sql
+58
-0
未找到文件。
src/Parsers/ASTAlterQuery.cpp
浏览文件 @
a4c43e51
...
...
@@ -101,7 +101,7 @@ void ASTAlterCommand::formatImpl(
if
(
to_remove
!=
RemoveProperty
::
NO_PROPERTY
)
{
settings
.
ostr
<<
(
settings
.
hilite
?
hilite_keyword
:
""
)
<<
indent_str
<<
"
REMOVE "
;
settings
.
ostr
<<
(
settings
.
hilite
?
hilite_keyword
:
""
)
<<
"
REMOVE "
;
switch
(
to_remove
)
{
case
RemoveProperty
::
DEFAULT
:
...
...
src/Parsers/ParserAlterQuery.cpp
浏览文件 @
a4c43e51
...
...
@@ -438,7 +438,9 @@ bool ParserAlterCommand::parseImpl(Pos & pos, ASTPtr & node, Expected & expected
if
(
s_if_exists
.
ignore
(
pos
,
expected
))
command
->
if_exists
=
true
;
if
(
!
parser_modify_col_decl
.
parse
(
pos
,
command
->
col_decl
,
expected
))
ASTPtr
column_name
;
Pos
stop_pos
=
pos
;
if
(
!
parser_name
.
parse
(
pos
,
column_name
,
expected
))
return
false
;
if
(
s_remove
.
ignore
(
pos
,
expected
))
...
...
@@ -457,9 +459,17 @@ bool ParserAlterCommand::parseImpl(Pos & pos, ASTPtr & node, Expected & expected
command
->
to_remove
=
RemoveProperty
::
TTL
;
else
return
false
;
auto
column_declaration
=
std
::
make_shared
<
ASTColumnDeclaration
>
();
tryGetIdentifierNameInto
(
column_name
,
column_declaration
->
name
);
command
->
col_decl
=
column_declaration
;
}
else
{
pos
=
stop_pos
;
if
(
!
parser_modify_col_decl
.
parse
(
pos
,
command
->
col_decl
,
expected
))
return
false
;
if
(
s_first
.
ignore
(
pos
,
expected
))
command
->
first
=
true
;
else
if
(
s_after
.
ignore
(
pos
,
expected
))
...
...
src/Storages/AlterCommands.cpp
浏览文件 @
a4c43e51
...
...
@@ -111,7 +111,6 @@ std::optional<AlterCommand> AlterCommand::parse(const ASTAlterCommand * command_
command
.
type
=
AlterCommand
::
MODIFY_COLUMN
;
const
auto
&
ast_col_decl
=
command_ast
->
col_decl
->
as
<
ASTColumnDeclaration
&>
();
command
.
column_name
=
ast_col_decl
.
name
;
command
.
to_remove
=
command_ast
->
to_remove
;
...
...
tests/queries/0_stateless/01493_alter_remove_properties.reference
0 → 100644
浏览文件 @
a4c43e51
CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64 MATERIALIZED column_default * 42,\n `column_alias` UInt64 ALIAS column_default + 1,\n `column_codec` String CODEC(ZSTD(10)),\n `column_comment` Date COMMENT \'Some comment\',\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192
42 1764 43 str 2019-10-01 1
CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64 MATERIALIZED column_default * 42,\n `column_alias` UInt64 ALIAS column_default + 1,\n `column_codec` String CODEC(ZSTD(10)),\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192
CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64 MATERIALIZED column_default * 42,\n `column_alias` UInt64 ALIAS column_default + 1,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192
42 1764 0 str 2019-10-01 1
CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64 MATERIALIZED column_default * 42,\n `column_alias` UInt64,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192
42 1764 0 str 2019-10-01 1
42 1764 33 trs 2020-01-01 2
CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64,\n `column_alias` UInt64,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192
42 1764 0 str 2019-10-01 1
42 1764 33 trs 2020-01-01 2
42 11 44 rts 2020-02-01 3
CREATE TABLE default.prop_table\n(\n `column_default` UInt64,\n `column_materialized` UInt64,\n `column_alias` UInt64,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192
42 1764 0 str 2019-10-01 1
42 1764 33 trs 2020-01-01 2
42 11 44 rts 2020-02-01 3
0 22 55 tsr 2020-03-01 4
tests/queries/0_stateless/01493_alter_remove_properties.sql
0 → 100644
浏览文件 @
a4c43e51
DROP
TABLE
IF
EXISTS
prop_table
;
CREATE
TABLE
prop_table
(
column_default
UInt64
DEFAULT
42
,
column_materialized
UInt64
MATERIALIZED
column_default
*
42
,
column_alias
UInt64
ALIAS
column_default
+
1
,
column_codec
String
CODEC
(
ZSTD
(
10
)),
column_comment
Date
COMMENT
'Some comment'
,
column_ttl
UInt64
TTL
column_comment
+
INTERVAL
1
MONTH
)
ENGINE
MergeTree
()
ORDER
BY
tuple
()
TTL
column_comment
+
INTERVAL
2
MONTH
;
SHOW
CREATE
TABLE
prop_table
;
SYSTEM
STOP
TTL
MERGES
prop_table
;
INSERT
INTO
prop_table
(
column_codec
,
column_comment
,
column_ttl
)
VALUES
(
'str'
,
toDate
(
'2019-10-01'
),
1
);
SELECT
column_default
,
column_materialized
,
column_alias
,
column_codec
,
column_comment
,
column_ttl
FROM
prop_table
;
ALTER
TABLE
prop_table
MODIFY
COLUMN
column_comment
REMOVE
COMMENT
;
SHOW
CREATE
TABLE
prop_table
;
ALTER
TABLE
prop_table
MODIFY
COLUMN
column_codec
REMOVE
CODEC
;
SHOW
CREATE
TABLE
prop_table
;
ALTER
TABLE
prop_table
MODIFY
COLUMN
column_alias
REMOVE
ALIAS
;
SELECT
column_default
,
column_materialized
,
column_alias
,
column_codec
,
column_comment
,
column_ttl
FROM
prop_table
;
SHOW
CREATE
TABLE
prop_table
;
INSERT
INTO
prop_table
(
column_alias
,
column_codec
,
column_comment
,
column_ttl
)
VALUES
(
33
,
'trs'
,
toDate
(
'2020-01-01'
),
2
);
SELECT
column_default
,
column_materialized
,
column_alias
,
column_codec
,
column_comment
,
column_ttl
FROM
prop_table
ORDER
BY
column_ttl
;
ALTER
TABLE
prop_table
MODIFY
COLUMN
column_materialized
REMOVE
MATERIALIZED
;
SHOW
CREATE
TABLE
prop_table
;
INSERT
INTO
prop_table
(
column_materialized
,
column_alias
,
column_codec
,
column_comment
,
column_ttl
)
VALUES
(
11
,
44
,
'rts'
,
toDate
(
'2020-02-01'
),
3
);
SELECT
column_default
,
column_materialized
,
column_alias
,
column_codec
,
column_comment
,
column_ttl
FROM
prop_table
ORDER
BY
column_ttl
;
ALTER
TABLE
prop_table
MODIFY
COLUMN
column_default
REMOVE
DEFAULT
;
SHOW
CREATE
TABLE
prop_table
;
INSERT
INTO
prop_table
(
column_materialized
,
column_alias
,
column_codec
,
column_comment
,
column_ttl
)
VALUES
(
22
,
55
,
'tsr'
,
toDate
(
'2020-03-01'
),
4
);
SELECT
column_default
,
column_materialized
,
column_alias
,
column_codec
,
column_comment
,
column_ttl
FROM
prop_table
ORDER
BY
column_ttl
;
DROP
TABLE
IF
EXISTS
prop_table
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录