Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
cbfd862f
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,发现更多精彩内容 >>
提交
cbfd862f
编写于
3月 22, 2018
作者:
N
Nikolai Kochetov
提交者:
alexey-milovidov
3月 22, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix reading with evaluated defaults [#CLICKHOUSE-3663]
上级
f4b742e9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
9 deletion
+12
-9
dbms/src/Storages/MergeTree/MergeTreeBaseBlockInputStream.cpp
.../src/Storages/MergeTree/MergeTreeBaseBlockInputStream.cpp
+4
-4
dbms/src/Storages/MergeTree/MergeTreeReader.cpp
dbms/src/Storages/MergeTree/MergeTreeReader.cpp
+3
-4
dbms/src/Storages/MergeTree/MergeTreeReader.h
dbms/src/Storages/MergeTree/MergeTreeReader.h
+5
-1
未找到文件。
dbms/src/Storages/MergeTree/MergeTreeBaseBlockInputStream.cpp
浏览文件 @
cbfd862f
...
...
@@ -216,7 +216,7 @@ Block MergeTreeBaseBlockInputStream::readFromPart()
}
progressImpl
({
res
.
rows
(),
res
.
bytes
()
});
pre_reader
->
fillMissingColumns
(
res
,
task
->
ordered_names
,
task
->
should_reorder
);
pre_reader
->
fillMissingColumns
(
res
,
task
->
ordered_names
,
task
->
should_reorder
,
res
.
rows
()
);
/// Compute the expression in PREWHERE.
prewhere_actions
->
execute
(
res
);
...
...
@@ -396,7 +396,7 @@ Block MergeTreeBaseBlockInputStream::readFromPart()
/// as a result of reading components of Nested data structures with no data in filesystem.
/// We must fill these arrays to filter them correctly.
reader
->
fillMissingColumns
(
res
,
task
->
ordered_names
,
task
->
should_reorder
);
reader
->
fillMissingColumns
(
res
,
task
->
ordered_names
,
task
->
should_reorder
,
post_filter
.
size
(),
true
);
/// Filter the columns related to PREWHERE using pre_filter,
/// other columns - using post_filter.
...
...
@@ -422,7 +422,7 @@ Block MergeTreeBaseBlockInputStream::readFromPart()
if
(
task
->
size_predictor
)
task
->
size_predictor
->
update
(
res
);
reader
->
fillMissingColumns
(
res
,
task
->
ordered_names
,
true
);
reader
->
fillMissingColumns
(
res
,
task
->
ordered_names
,
true
,
res
.
rows
()
);
res
.
checkNumberOfRows
();
}
...
...
@@ -464,7 +464,7 @@ Block MergeTreeBaseBlockInputStream::readFromPart()
return
res
;
progressImpl
({
res
.
rows
(),
res
.
bytes
()
});
reader
->
fillMissingColumns
(
res
,
task
->
ordered_names
,
task
->
should_reorder
);
reader
->
fillMissingColumns
(
res
,
task
->
ordered_names
,
task
->
should_reorder
,
res
.
rows
()
);
}
return
res
;
...
...
dbms/src/Storages/MergeTree/MergeTreeReader.cpp
浏览文件 @
cbfd862f
...
...
@@ -413,7 +413,8 @@ static bool arrayHasNoElementsRead(const IColumn & column)
}
void
MergeTreeReader
::
fillMissingColumns
(
Block
&
res
,
const
Names
&
ordered_names
,
bool
always_reorder
)
void
MergeTreeReader
::
fillMissingColumns
(
Block
&
res
,
const
Names
&
ordered_names
,
bool
always_reorder
,
size_t
rows
,
bool
never_evaluate_defaults
)
{
if
(
!
res
)
throw
Exception
(
"Empty block passed to fillMissingColumns"
,
ErrorCodes
::
LOGICAL_ERROR
);
...
...
@@ -444,8 +445,6 @@ void MergeTreeReader::fillMissingColumns(Block & res, const Names & ordered_name
bool
should_evaluate_defaults
=
false
;
bool
should_sort
=
always_reorder
;
size_t
rows
=
res
.
rows
();
/// insert default values only for columns without default expressions
for
(
const
auto
&
requested_column
:
columns
)
{
...
...
@@ -497,7 +496,7 @@ void MergeTreeReader::fillMissingColumns(Block & res, const Names & ordered_name
}
/// evaluate defaulted columns if necessary
if
(
should_evaluate_defaults
)
if
(
!
never_evaluate_defaults
&&
should_evaluate_defaults
)
evaluateMissingDefaults
(
res
,
columns
,
storage
.
getColumns
().
defaults
,
storage
.
context
);
/// sort columns to ensure consistent order among all blocks
...
...
dbms/src/Storages/MergeTree/MergeTreeReader.h
浏览文件 @
cbfd862f
...
...
@@ -44,7 +44,11 @@ public:
/// Add columns from ordered_names that are not present in the block.
/// Missing columns are added in the order specified by ordered_names.
/// If at least one column was added, reorders all columns in the block according to ordered_names.
void
fillMissingColumns
(
Block
&
res
,
const
Names
&
ordered_names
,
const
bool
always_reorder
);
/// Rows is the number of rows will be used to create default columns. It's res.rows() when all columns in block has the same size.
/// This function may be used in order to create default columns in nested structures. In that case block may has
/// columns with different size, and default columns can't be evaluated, so never_evaluate_defaults = false is used.
void
fillMissingColumns
(
Block
&
res
,
const
Names
&
ordered_names
,
const
bool
always_reorder
,
size_t
rows
,
bool
never_evaluate_defaults
=
false
);
private:
class
Stream
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录