Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
559478e4
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,发现更多精彩内容 >>
提交
559478e4
编写于
1月 12, 2021
作者:
R
robot-clickhouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Backport #18944 to 20.12: Fix mutations text serialization
上级
3c0e8937
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
3 deletion
+24
-3
src/Storages/MutationCommands.cpp
src/Storages/MutationCommands.cpp
+4
-3
tests/queries/0_stateless/01648_mutations_and_escaping.reference
...ueries/0_stateless/01648_mutations_and_escaping.reference
+2
-0
tests/queries/0_stateless/01648_mutations_and_escaping.sql
tests/queries/0_stateless/01648_mutations_and_escaping.sql
+18
-0
未找到文件。
src/Storages/MutationCommands.cpp
浏览文件 @
559478e4
#include <Storages/MutationCommands.h>
#include <Storages/MutationCommands.h>
#include <IO/Operators.h>
#include <IO/WriteHelpers.h>
#include <IO/ReadHelpers.h>
#include <Parsers/formatAST.h>
#include <Parsers/formatAST.h>
#include <Parsers/ExpressionListParsers.h>
#include <Parsers/ExpressionListParsers.h>
#include <Parsers/ParserAlterQuery.h>
#include <Parsers/ParserAlterQuery.h>
...
@@ -133,13 +134,13 @@ void MutationCommands::writeText(WriteBuffer & out) const
...
@@ -133,13 +134,13 @@ void MutationCommands::writeText(WriteBuffer & out) const
{
{
WriteBufferFromOwnString
commands_buf
;
WriteBufferFromOwnString
commands_buf
;
formatAST
(
*
ast
(),
commands_buf
,
/* hilite = */
false
,
/* one_line = */
true
);
formatAST
(
*
ast
(),
commands_buf
,
/* hilite = */
false
,
/* one_line = */
true
);
out
<<
escape
<<
commands_buf
.
str
(
);
writeEscapedString
(
commands_buf
.
str
(),
out
);
}
}
void
MutationCommands
::
readText
(
ReadBuffer
&
in
)
void
MutationCommands
::
readText
(
ReadBuffer
&
in
)
{
{
String
commands_str
;
String
commands_str
;
in
>>
escape
>>
commands_str
;
readEscapedString
(
commands_str
,
in
)
;
ParserAlterCommandList
p_alter_commands
;
ParserAlterCommandList
p_alter_commands
;
auto
commands_ast
=
parseQuery
(
auto
commands_ast
=
parseQuery
(
...
...
tests/queries/0_stateless/01648_mutations_and_escaping.reference
0 → 100644
浏览文件 @
559478e4
foo
foo
tests/queries/0_stateless/01648_mutations_and_escaping.sql
0 → 100644
浏览文件 @
559478e4
DROP
TABLE
IF
EXISTS
mutations_and_escaping_1648
;
CREATE
TABLE
mutations_and_escaping_1648
(
d
Date
,
e
Enum8
(
'foo'
=
1
,
'bar'
=
2
))
Engine
=
MergeTree
(
d
,
(
d
),
8192
);
INSERT
INTO
mutations_and_escaping_1648
(
d
,
e
)
VALUES
(
'2018-01-01'
,
'foo'
);
INSERT
INTO
mutations_and_escaping_1648
(
d
,
e
)
VALUES
(
'2018-01-02'
,
'bar'
);
-- slow mutation
ALTER
TABLE
mutations_and_escaping_1648
UPDATE
e
=
CAST
(
'foo'
,
'Enum8(
\'
foo
\'
= 1,
\'
bar
\'
= 2)'
)
WHERE
d
=
'2018-01-02'
and
sleepEachRow
(
1
)
=
0
;
-- check that we able to read mutation text after serialization
DETACH
TABLE
mutations_and_escaping_1648
;
ATTACH
TABLE
mutations_and_escaping_1648
;
ALTER
TABLE
mutations_and_escaping_1648
UPDATE
e
=
CAST
(
'foo'
,
'Enum8(
\'
foo
\'
= 1,
\'
bar
\'
= 2)'
)
WHERE
d
=
'2018-01-02'
SETTINGS
mutations_sync
=
1
;
SELECT
e
FROM
mutations_and_escaping_1648
ORDER
BY
d
;
DROP
TABLE
mutations_and_escaping_1648
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录