Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
0c38226a
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,发现更多精彩内容 >>
未验证
提交
0c38226a
编写于
5月 25, 2019
作者:
A
alexey-milovidov
提交者:
GitHub
5月 25, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5366 from abyss7/storage-merge-sample
Check that underlying tables support sampling for StorageMerge
上级
fbbe3c12
28bddf9a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
0 deletion
+44
-0
dbms/src/Storages/StorageMerge.cpp
dbms/src/Storages/StorageMerge.cpp
+6
-0
dbms/tests/queries/0_stateless/00578_merge_table_sampling.reference
.../queries/0_stateless/00578_merge_table_sampling.reference
+20
-0
dbms/tests/queries/0_stateless/00578_merge_table_sampling.sql
.../tests/queries/0_stateless/00578_merge_table_sampling.sql
+18
-0
未找到文件。
dbms/src/Storages/StorageMerge.cpp
浏览文件 @
0c38226a
...
...
@@ -41,6 +41,7 @@ namespace ErrorCodes
extern
const
int
NUMBER_OF_ARGUMENTS_DOESNT_MATCH
;
extern
const
int
NO_SUCH_COLUMN_IN_TABLE
;
extern
const
int
BLOCKS_HAVE_DIFFERENT_STRUCTURE
;
extern
const
int
SAMPLING_NOT_SUPPORTED
;
}
...
...
@@ -218,6 +219,7 @@ BlockInputStreams StorageMerge::read(
query_info
.
query
,
has_table_virtual_column
,
true
,
context
.
getCurrentQueryId
());
if
(
selected_tables
.
empty
())
/// FIXME: do we support sampling in this case?
return
createSourceStreams
(
query_info
,
processed_stage
,
max_block_size
,
header
,
{},
{},
real_column_names
,
modified_context
,
0
,
has_table_virtual_column
);
...
...
@@ -234,6 +236,10 @@ BlockInputStreams StorageMerge::read(
StoragePtr
storage
=
it
->
first
;
TableStructureReadLockHolder
struct_lock
=
it
->
second
;
/// If sampling requested, then check that table supports it.
if
(
query_info
.
query
->
as
<
ASTSelectQuery
>
()
->
sample_size
()
&&
!
storage
->
supportsSampling
())
throw
Exception
(
"Illegal SAMPLE: table doesn't support sampling"
,
ErrorCodes
::
SAMPLING_NOT_SUPPORTED
);
BlockInputStreams
source_streams
;
if
(
current_streams
)
...
...
dbms/tests/queries/0_stateless/00578_merge_table_sampling.reference
0 → 100644
浏览文件 @
0c38226a
494
331
576
709
903
378
498
102
861
97
494
331
576
709
903
378
498
102
861
97
dbms/tests/queries/0_stateless/00578_merge_table_sampling.sql
0 → 100644
浏览文件 @
0c38226a
DROP
TABLE
IF
EXISTS
test
.
numbers1
;
DROP
TABLE
IF
EXISTS
test
.
numbers2
;
CREATE
TABLE
test
.
numbers1
ENGINE
=
Memory
AS
SELECT
number
FROM
numbers
(
1000
);
CREATE
TABLE
test
.
numbers2
ENGINE
=
Memory
AS
SELECT
number
FROM
numbers
(
1000
);
SELECT
*
FROM
merge
(
test
,
'^numbers
\\
d+$'
)
SAMPLE
0
.
1
;
-- { serverError 141 }
DROP
TABLE
test
.
numbers1
;
DROP
TABLE
test
.
numbers2
;
CREATE
TABLE
test
.
numbers1
ENGINE
=
MergeTree
ORDER
BY
intHash32
(
number
)
SAMPLE
BY
intHash32
(
number
)
AS
SELECT
number
FROM
numbers
(
1000
);
CREATE
TABLE
test
.
numbers2
ENGINE
=
MergeTree
ORDER
BY
intHash32
(
number
)
SAMPLE
BY
intHash32
(
number
)
AS
SELECT
number
FROM
numbers
(
1000
);
SELECT
*
FROM
merge
(
test
,
'^numbers
\\
d+$'
)
SAMPLE
0
.
01
;
DROP
TABLE
test
.
numbers1
;
DROP
TABLE
test
.
numbers2
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录