Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
54c82343
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,发现更多精彩内容 >>
提交
54c82343
编写于
1月 22, 2020
作者:
V
Vitaliy Zakaznikov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reworking fix for missing columns.
上级
78ab3127
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
28 deletion
+14
-28
dbms/src/DataStreams/ConvertingBlockInputStream.cpp
dbms/src/DataStreams/ConvertingBlockInputStream.cpp
+2
-21
dbms/src/DataStreams/ConvertingBlockInputStream.h
dbms/src/DataStreams/ConvertingBlockInputStream.h
+1
-4
dbms/src/DataStreams/PushingToViewsBlockOutputStream.cpp
dbms/src/DataStreams/PushingToViewsBlockOutputStream.cpp
+10
-2
dbms/tests/queries/0_stateless/01069_materialized_view_alter_target_table_with_default_expression.reference
...view_alter_target_table_with_default_expression.reference
+1
-1
未找到文件。
dbms/src/DataStreams/ConvertingBlockInputStream.cpp
浏览文件 @
54c82343
...
...
@@ -5,6 +5,7 @@
#include <Common/quoteString.h>
#include <Parsers/IAST.h>
namespace
DB
{
...
...
@@ -64,18 +65,8 @@ ConvertingBlockInputStream::ConvertingBlockInputStream(
throw
Exception
(
"Cannot find column "
+
backQuote
(
res_elem
.
name
)
+
" in source stream"
,
ErrorCodes
::
THERE_IS_NO_COLUMN
);
break
;
case
MatchColumnsMode
::
NameOrDefault
:
if
(
input_header
.
has
(
res_elem
.
name
))
conversion
[
result_col_num
]
=
input_header
.
getPositionByName
(
res_elem
.
name
);
else
conversion
[
result_col_num
]
=
USE_DEFAULT
;
break
;
}
if
(
conversion
[
result_col_num
]
==
USE_DEFAULT
)
continue
;
const
auto
&
src_elem
=
input_header
.
getByPosition
(
conversion
[
result_col_num
]);
/// Check constants.
...
...
@@ -109,17 +100,8 @@ Block ConvertingBlockInputStream::readImpl()
Block
res
=
header
.
cloneEmpty
();
for
(
size_t
res_pos
=
0
,
size
=
conversion
.
size
();
res_pos
<
size
;
++
res_pos
)
{
auto
&
res_elem
=
res
.
getByPosition
(
res_pos
);
if
(
conversion
[
res_pos
]
==
USE_DEFAULT
)
{
// Create a column with default values
auto
column_with_defaults
=
res_elem
.
type
->
createColumn
()
->
cloneResized
(
src
.
rows
());
res_elem
.
column
=
std
::
move
(
column_with_defaults
);
continue
;
}
const
auto
&
src_elem
=
src
.
getByPosition
(
conversion
[
res_pos
]);
auto
&
res_elem
=
res
.
getByPosition
(
res_pos
);
ColumnPtr
converted
=
castColumnWithDiagnostic
(
src_elem
,
res_elem
,
context
);
...
...
@@ -132,4 +114,3 @@ Block ConvertingBlockInputStream::readImpl()
}
}
dbms/src/DataStreams/ConvertingBlockInputStream.h
浏览文件 @
54c82343
...
...
@@ -28,9 +28,7 @@ public:
/// Require same number of columns in source and result. Match columns by corresponding positions, regardless to names.
Position
,
/// Find columns in source by their names. Allow excessive columns in source.
Name
,
/// Find columns in source by their names if present else use the default. Allow excessive columns in source.
NameOrDefault
Name
};
ConvertingBlockInputStream
(
...
...
@@ -50,7 +48,6 @@ private:
/// How to construct result block. Position in source block, where to get each column.
using
Conversion
=
std
::
vector
<
size_t
>
;
const
size_t
USE_DEFAULT
=
static_cast
<
size_t
>
(
-
1
);
Conversion
conversion
;
};
...
...
dbms/src/DataStreams/PushingToViewsBlockOutputStream.cpp
浏览文件 @
54c82343
...
...
@@ -231,8 +231,16 @@ void PushingToViewsBlockOutputStream::process(const Block & block, size_t view_n
/// and two-level aggregation is triggered).
in
=
std
::
make_shared
<
SquashingBlockInputStream
>
(
in
,
context
.
getSettingsRef
().
min_insert_block_size_rows
,
context
.
getSettingsRef
().
min_insert_block_size_bytes
);
in
=
std
::
make_shared
<
AddingMissedBlockInputStream
>
(
in
,
view
.
out
->
getHeader
(),
storage
->
getColumns
().
getDefaults
(),
local_context
);
auto
view_table
=
context
.
getTable
(
view
.
table_id
);
if
(
auto
*
materialized_view
=
dynamic_cast
<
const
StorageMaterializedView
*>
(
view_table
.
get
()))
{
StoragePtr
inner_table
=
materialized_view
->
getTargetTable
();
in
=
std
::
make_shared
<
AddingMissedBlockInputStream
>
(
in
,
view
.
out
->
getHeader
(),
inner_table
->
getColumns
().
getDefaults
(),
context
);
}
in
=
std
::
make_shared
<
ConvertingBlockInputStream
>
(
context
,
in
,
view
.
out
->
getHeader
(),
ConvertingBlockInputStream
::
MatchColumnsMode
::
Name
);
}
else
...
...
dbms/tests/queries/0_stateless/01069_materialized_view_alter_target_table_with_default_expression.reference
浏览文件 @
54c82343
...
...
@@ -2,7 +2,7 @@
1
2
3
1
0
1
2
1 2
2 3
3 4
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录