Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature](csv)Supports reading CSV data using LF and CRLF as line separators. (#37687) #38099

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

hubgeter
Copy link
Contributor

bp #37687

Proposed changes

Supports reading CSV data using LF and CRLF as line separators.

csv file:

1,abc
2,def\r
3,qwe
4,hello\r

if you set keep_carriage_return = false
you will get :

1   abc
2   def
3   qwe
4   hello

Here, both \r\n and \n are used as delimiters.

if you set keep_carriage_return = true
you will get :

1   abc
2   def\r
3   qwe
4   hello\r

Here only \n is used as a delimiter.

It should be noted that set keep_carriage_return = true is valid for tvf, but not for stream load/mysql load. This means that when you perform stream load/mysql load, crlf and lf will be automatically used as delimiters, even if you set keep_carriage_return = true.

…arators. (apache#37687)

## Proposed changes

Supports reading CSV data using LF and CRLF as line separators.

csv file:
```
1,abc
2,def\r
3,qwe
4,hello\r
```
if you  `set keep_carriage_return = false`
you will get : 
```mysql
1   abc
2   def 
3   qwe
4   hello 
```
Here, both \r\n and \n are used as delimiters.

if you  `set keep_carriage_return = true`
you will get : 
```mysql
1   abc
2   def\r
3   qwe
4   hello\r 
```
Here only \n is used as a delimiter.

## warning
It should be noted that `set keep_carriage_return = true` is valid for
tvf, but not for stream load/mysql load. This means that when you
perform stream load/mysql load, crlf and lf will be automatically used
as delimiters, even if you `set keep_carriage_return = true`.
@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@hubgeter
Copy link
Contributor Author

run buildall

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.45% (9238/25345)
Line Coverage: 27.98% (75500/269826)
Region Coverage: 26.80% (38814/144831)
Branch Coverage: 23.54% (19707/83712)
Coverage Report: http://coverage.selectdb-in.cc/coverage/21c1bbb5beb752008f71d1d8e1c4e8ce742e6b6a_21c1bbb5beb752008f71d1d8e1c4e8ce742e6b6a/report/index.html

@morningman morningman merged commit 193be20 into apache:branch-2.1 Jul 22, 2024
20 of 22 checks passed
@yiguolei yiguolei mentioned this pull request Sep 5, 2024
3 tasks
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants