[Bug][Outfile] Fix bug that column separater is missing in output file. (#3765)
When output result of a query using `OUTFILE` statement, is some of output column is null, then then following column separator is missing.
This commit is contained in:
@ -149,6 +149,9 @@ Status FileResultWriter::_write_one_row_as_csv(TupleRow* row) {
|
||||
|
||||
if (item == nullptr) {
|
||||
_plain_text_outstream << NULL_IN_CSV;
|
||||
if (i < num_columns - 1) {
|
||||
_plain_text_outstream << _file_opts->column_separator;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -184,3 +184,5 @@ mysql> SELECT * FROM tbl INTO OUTFILE ...
|
||||
* The timeout of the export command is the same as the timeout of the query. It can be set by `SET query_timeout = xxx`.
|
||||
* For empty result query, there will be an empty file.
|
||||
* File spliting will ensure that a row of data is stored in a single file. Therefore, the size of the file is not strictly equal to `max_file_size`.
|
||||
* For functions whose output is invisible characters, such as BITMAP and HLL types, the output is `\N`, which is NULL.
|
||||
* At present, the output type of some geo functions, such as `ST_Point` is VARCHAR, but the actual output value is an encoded binary character. Currently these functions will output garbled characters. For geo functions, use `ST_AsText` for output.
|
||||
|
||||
@ -180,3 +180,5 @@ mysql> SELECT * FROM tbl INTO OUTFILE ...
|
||||
* 导出命令的超时时间同查询的超时时间。可以通过 `SET query_timeout=xxx` 进行设置。
|
||||
* 对于结果集为空的查询,依然会产生一个大小为0的文件。
|
||||
* 文件切分会保证一行数据完整的存储在单一文件中。因此文件的大小并不严格等于 `max_file_size`。
|
||||
* 对于部分输出为非可见字符的函数,如 BITMAP、HLL 类型,输出为 `\N`,即 NULL。
|
||||
* 目前部分地理信息函数,如 `ST_Point` 的输出类型为 VARCHAR,但实际输出值为经过编码的二进制字符。当前这些函数会输出乱码。对于地理函数,请使用 `ST_AsText` 进行输出。
|
||||
|
||||
Reference in New Issue
Block a user