v.23.11Improvement

CSV Parsing Error in ClickHouse Due to Improper Line Endings

While read data from a csv format file, and at end of line is \r , which not followed by \n, then we will enconter the exception as follows Cannot parse CSV format: found \r (CR) not followed by \n (LF). Line must end by \n (LF) or \r\n (CR LF) or \n\r. In clickhouse, the csv end of line must be \n or \r\n or \n\r, so the \r must be followed by \n, but in some situation, the csv input data is abnormal, like above, \r is at end of line. #54340 (KevinyhZou).
ClickHouse CSV format parser now supports lines ending with a standalone carriage return (\r) character, without requiring a following line feed (\n).

Why it matters

This feature addresses the issue where reading CSV files with lines ending in only a carriage return (\r) caused parsing exceptions. It improves robustness by allowing ClickHouse to handle CSV files with abnormal or non-standard line endings, preventing errors during data import.

How to use it

No special configuration is required. ClickHouse CSV format parsing automatically accepts CSV files with line endings using a single \r character at the end of lines without a following \n, just like with standard line endings (\n, \r\n, or \n\r). Simply import or read CSV files as usual.