Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
70f0ba1c
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,发现更多精彩内容 >>
未验证
提交
70f0ba1c
编写于
8月 11, 2020
作者:
A
Alexander Kuzmenkov
提交者:
GitHub
8月 11, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13343 from azat/format-fixes-20.7
WithNames format fixes
上级
7371cf6b
72205cd3
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
134 addition
and
8 deletion
+134
-8
src/Processors/Formats/IOutputFormat.cpp
src/Processors/Formats/IOutputFormat.cpp
+6
-0
src/Processors/Formats/IOutputFormat.h
src/Processors/Formats/IOutputFormat.h
+2
-0
src/Processors/Formats/Impl/TabSeparatedRowOutputFormat.cpp
src/Processors/Formats/Impl/TabSeparatedRowOutputFormat.cpp
+1
-1
src/Processors/Formats/Impl/TabSeparatedRowOutputFormat.h
src/Processors/Formats/Impl/TabSeparatedRowOutputFormat.h
+2
-1
src/Processors/Sources/SinkToOutputStream.cpp
src/Processors/Sources/SinkToOutputStream.cpp
+1
-5
src/Processors/Sources/SinkToOutputStream.h
src/Processors/Sources/SinkToOutputStream.h
+0
-1
tests/queries/0_stateless/01375_output_format_tsv_csv_with_names.reference
...tateless/01375_output_format_tsv_csv_with_names.reference
+13
-0
tests/queries/0_stateless/01375_output_format_tsv_csv_with_names.sh
...ies/0_stateless/01375_output_format_tsv_csv_with_names.sh
+18
-0
tests/queries/0_stateless/01375_storage_file_tsv_csv_with_names_write_prefix.reference
...75_storage_file_tsv_csv_with_names_write_prefix.reference
+17
-0
tests/queries/0_stateless/01375_storage_file_tsv_csv_with_names_write_prefix.sh
...ess/01375_storage_file_tsv_csv_with_names_write_prefix.sh
+30
-0
tests/queries/0_stateless/01375_storage_file_write_prefix_csv_with_names.reference
.../01375_storage_file_write_prefix_csv_with_names.reference
+0
-0
tests/queries/0_stateless/01375_storage_file_write_prefix_csv_with_names.sql
...teless/01375_storage_file_write_prefix_csv_with_names.sql
+0
-0
tests/queries/0_stateless/01375_storage_file_write_prefix_tsv_with_names.reference
.../01375_storage_file_write_prefix_tsv_with_names.reference
+30
-0
tests/queries/0_stateless/01375_storage_file_write_prefix_tsv_with_names.sql
...teless/01375_storage_file_write_prefix_tsv_with_names.sql
+14
-0
未找到文件。
src/Processors/Formats/IOutputFormat.cpp
浏览文件 @
70f0ba1c
...
...
@@ -46,6 +46,12 @@ IOutputFormat::Status IOutputFormat::prepare()
void
IOutputFormat
::
work
()
{
if
(
!
prefix_written
)
{
doWritePrefix
();
prefix_written
=
true
;
}
if
(
finished
&&
!
finalized
)
{
if
(
rows_before_limit_counter
&&
rows_before_limit_counter
->
hasAppliedLimit
())
...
...
src/Processors/Formats/IOutputFormat.h
浏览文件 @
70f0ba1c
...
...
@@ -87,6 +87,8 @@ private:
/// Counters for consumed chunks. Are used for QueryLog.
size_t
result_rows
=
0
;
size_t
result_bytes
=
0
;
bool
prefix_written
=
false
;
};
}
src/Processors/Formats/Impl/TabSeparatedRowOutputFormat.cpp
浏览文件 @
70f0ba1c
...
...
@@ -18,7 +18,7 @@ TabSeparatedRowOutputFormat::TabSeparatedRowOutputFormat(
}
void
TabSeparatedRowOutputFormat
::
w
ritePrefix
()
void
TabSeparatedRowOutputFormat
::
doW
ritePrefix
()
{
const
auto
&
header
=
getPort
(
PortKind
::
Main
).
getHeader
();
size_t
columns
=
header
.
columns
();
...
...
src/Processors/Formats/Impl/TabSeparatedRowOutputFormat.h
浏览文件 @
70f0ba1c
...
...
@@ -31,10 +31,11 @@ public:
void
writeField
(
const
IColumn
&
column
,
const
IDataType
&
type
,
size_t
row_num
)
override
;
void
writeFieldDelimiter
()
override
;
void
writeRowEndDelimiter
()
override
;
void
writePrefix
()
override
;
void
writeBeforeTotals
()
override
;
void
writeBeforeExtremes
()
override
;
void
doWritePrefix
()
override
;
/// https://www.iana.org/assignments/media-types/text/tab-separated-values
String
getContentType
()
const
override
{
return
"text/tab-separated-values; charset=UTF-8"
;
}
...
...
src/Processors/Sources/SinkToOutputStream.cpp
浏览文件 @
70f0ba1c
...
...
@@ -8,15 +8,11 @@ SinkToOutputStream::SinkToOutputStream(BlockOutputStreamPtr stream_)
:
ISink
(
stream_
->
getHeader
())
,
stream
(
std
::
move
(
stream_
))
{
stream
->
writePrefix
();
}
void
SinkToOutputStream
::
consume
(
Chunk
chunk
)
{
if
(
!
initialized
)
stream
->
writePrefix
();
initialized
=
true
;
stream
->
write
(
getPort
().
getHeader
().
cloneWithColumns
(
chunk
.
detachColumns
()));
}
...
...
src/Processors/Sources/SinkToOutputStream.h
浏览文件 @
70f0ba1c
...
...
@@ -22,7 +22,6 @@ protected:
private:
BlockOutputStreamPtr
stream
;
bool
initialized
=
false
;
};
}
tests/queries/0_stateless/01375_output_format_tsv_csv_with_names.reference
0 → 100644
浏览文件 @
70f0ba1c
TSVWithNames
number
0
1
TSVWithNamesAndTypes
number
UInt64
0
1
CSVWithNames
"number"
0
1
tests/queries/0_stateless/01375_output_format_tsv_csv_with_names.sh
0 → 100755
浏览文件 @
70f0ba1c
#!/usr/bin/env bash
CURDIR
=
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
.
"
$CURDIR
"
/../shell_config.sh
opts
=(
--input-format
CSV
-q
'SELECT number FROM numbers(2)'
)
echo
'TSVWithNames'
${
CLICKHOUSE_LOCAL
}
"
${
opts
[@]
}
"
--format
TSVWithNames
echo
'TSVWithNamesAndTypes'
${
CLICKHOUSE_LOCAL
}
"
${
opts
[@]
}
"
--format
TSVWithNamesAndTypes
echo
'CSVWithNames'
${
CLICKHOUSE_LOCAL
}
"
${
opts
[@]
}
"
--format
CSVWithNames
tests/queries/0_stateless/01375_storage_file_tsv_csv_with_names_write_prefix.reference
0 → 100644
浏览文件 @
70f0ba1c
zero rows
TSVWithNames
TSVWithNamesAndTypes
CSVWithNames
multi clickhouse-local one file
TSVWithNames
0
0
0
TSVWithNamesAndTypes
0
0
0
CSVWithNames
0
0
0
tests/queries/0_stateless/01375_storage_file_tsv_csv_with_names_write_prefix.sh
0 → 100755
浏览文件 @
70f0ba1c
#!/usr/bin/env bash
CURDIR
=
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
.
"
$CURDIR
"
/../shell_config.sh
# zero rows
echo
'zero rows'
for
format
in
TSVWithNames TSVWithNamesAndTypes CSVWithNames
;
do
echo
$format
${
CLICKHOUSE_LOCAL
}
--query
=
"
CREATE TABLE
${
format
}
_01375 ENGINE File(
$format
, '01375_
$format
.tsv') AS SELECT * FROM numbers(1) WHERE number < 0;
SELECT * FROM
${
format
}
_01375;
DROP TABLE
${
format
}
_01375;
"
rm
01375_
$format
.tsv
done
# run multiple times to the same file
echo
'multi clickhouse-local one file'
for
format
in
TSVWithNames TSVWithNamesAndTypes CSVWithNames
;
do
echo
$format
for
_
in
{
1..2
}
;
do
${
CLICKHOUSE_LOCAL
}
--query
=
"
CREATE TABLE
${
format
}
_01375 ENGINE File(
$format
, '01375_
$format
.tsv') AS SELECT * FROM numbers(1);
SELECT * FROM
${
format
}
_01375;
DROP TABLE
${
format
}
_01375;
"
done
rm
01375_
$format
.tsv
done
tests/queries/0_stateless/01375_storage_file_write_prefix.reference
→
tests/queries/0_stateless/01375_storage_file_write_prefix
_csv_with_names
.reference
浏览文件 @
70f0ba1c
文件已移动
tests/queries/0_stateless/01375_storage_file_write_prefix.sql
→
tests/queries/0_stateless/01375_storage_file_write_prefix
_csv_with_names
.sql
浏览文件 @
70f0ba1c
文件已移动
tests/queries/0_stateless/01375_storage_file_write_prefix_tsv_with_names.reference
0 → 100644
浏览文件 @
70f0ba1c
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
tests/queries/0_stateless/01375_storage_file_write_prefix_tsv_with_names.sql
0 → 100644
浏览文件 @
70f0ba1c
DROP
TABLE
IF
EXISTS
tmp_01375
;
DROP
TABLE
IF
EXISTS
table_tsv_01375
;
CREATE
TABLE
tmp_01375
(
n
UInt32
,
s
String
)
ENGINE
=
Memory
;
CREATE
TABLE
table_tsv_01375
AS
tmp_01375
ENGINE
=
File
(
TSVWithNames
);
INSERT
INTO
table_tsv_01375
SELECT
number
as
n
,
toString
(
n
)
as
s
FROM
numbers
(
10
);
INSERT
INTO
table_tsv_01375
SELECT
number
as
n
,
toString
(
n
)
as
s
FROM
numbers
(
10
);
INSERT
INTO
table_tsv_01375
SELECT
number
as
n
,
toString
(
n
)
as
s
FROM
numbers
(
10
);
SELECT
*
FROM
table_tsv_01375
;
DROP
TABLE
IF
EXISTS
tmp_01375
;
DROP
TABLE
IF
EXISTS
table_tsv_01375
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录