Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
b1a97f90
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,发现更多精彩内容 >>
提交
b1a97f90
编写于
7月 12, 2018
作者:
A
Alexey Zatelepin
提交者:
alexey-milovidov
7月 16, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add test [#CLICKHOUSE-3748]
上级
88aa790a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
63 addition
and
0 deletion
+63
-0
dbms/tests/queries/0_stateless/00652_mergetree_mutations.reference
...s/queries/0_stateless/00652_mergetree_mutations.reference
+10
-0
dbms/tests/queries/0_stateless/00652_mergetree_mutations.sh
dbms/tests/queries/0_stateless/00652_mergetree_mutations.sh
+53
-0
未找到文件。
dbms/tests/queries/0_stateless/00652_mergetree_mutations.reference
0 → 100644
浏览文件 @
b1a97f90
Query should fail 1
Query should fail 2
Query involving aliases should fail on submission
2000-01-01 2 b
2000-01-01 5 e
2000-02-01 2 b
2000-02-01 5 e
mutation_1.txt DELETE WHERE x = 1 [''] [1] 0 1
mutation_5.txt DELETE WHERE (x % 2) = 1 [''] [5] 0 1
mutation_6.txt DELETE WHERE s = \'d\' [''] [6] 0 1
dbms/tests/queries/0_stateless/00652_mergetree_mutations.sh
0 → 100755
浏览文件 @
b1a97f90
#!/usr/bin/env bash
CURDIR
=
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
.
$CURDIR
/../shell_config.sh
${
CLICKHOUSE_CLIENT
}
--query
=
"DROP TABLE IF EXISTS test.mutations"
${
CLICKHOUSE_CLIENT
}
--query
=
"CREATE TABLE test.mutations(d Date, x UInt32, s String, a UInt32 ALIAS x + 1) ENGINE MergeTree(d, intDiv(x, 10), 8192)"
# Test a mutation on empty table
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.mutations DELETE WHERE x = 1"
# Insert some data
${
CLICKHOUSE_CLIENT
}
--query
=
"INSERT INTO test.mutations(d, x, s) VALUES
\
('2000-01-01', 1, 'a')"
${
CLICKHOUSE_CLIENT
}
--query
=
"INSERT INTO test.mutations(d, x, s) VALUES
\
('2000-01-01', 2, 'b'), ('2000-01-01', 3, 'c'), ('2000-01-01', 4, 'd')
\
('2000-02-01', 2, 'b'), ('2000-02-01', 3, 'c'), ('2000-02-01', 4, 'd')"
# Try some malformed queries that should fail validation.
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.mutations DELETE WHERE nonexistent = 0"
2>/dev/null
||
echo
"Query should fail 1"
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.mutations DELETE WHERE d = '11'"
2>/dev/null
||
echo
"Query should fail 2"
# TODO: Queries involving alias columns are not supported yet and should fail on submission.
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.mutations DELETE WHERE a = 0"
2>/dev/null
||
echo
"Query involving aliases should fail on submission"
# Delete some values
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.mutations DELETE WHERE x % 2 = 1"
${
CLICKHOUSE_CLIENT
}
--query
=
"ALTER TABLE test.mutations DELETE WHERE s = 'd'"
# Insert more data
${
CLICKHOUSE_CLIENT
}
--query
=
"INSERT INTO test.mutations(d, x, s) VALUES
\
('2000-01-01', 5, 'e'), ('2000-02-01', 5, 'e')"
# Wait until all mutations are done.
for
i
in
{
1..100
}
do
sleep
0.1
if
[[
$(
${
CLICKHOUSE_CLIENT
}
--query
=
"SELECT sum(is_done) FROM system.mutations WHERE table='mutations'"
)
-eq
3
]]
;
then
break
fi
if
[[
$i
-eq
100
]]
;
then
echo
"Timed out while waiting for mutations to execute!"
fi
done
# Check that the table contains only the data that should not be deleted.
${
CLICKHOUSE_CLIENT
}
--query
=
"SELECT * FROM test.mutations ORDER BY d, x"
# Check the contents of the system.mutations table.
${
CLICKHOUSE_CLIENT
}
--query
=
"SELECT mutation_id, command, block_numbers.partition_id, block_numbers.number, parts_to_do, is_done
\
FROM system.mutations WHERE table = 'mutations' ORDER BY mutation_id"
${
CLICKHOUSE_CLIENT
}
--query
=
"DROP TABLE test.mutations"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录