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

Incorrect float type parsing from stdin #3142

Closed
e11it opened this issue Sep 15, 2018 · 2 comments
Closed

Incorrect float type parsing from stdin #3142

e11it opened this issue Sep 15, 2018 · 2 comments
Assignees

Comments

@e11it
Copy link

e11it commented Sep 15, 2018

Привет!

Колонка с Float64 при парсинге "съедает" всю строку до конца

echo "2;2" |  clickhouse-local  --input-format "CSV"  --format_csv_delimiter ';' -S "b Float64, c Int64" -q "select * from table"
Code: 27, e.displayText() = DB::Exception: Cannot parse input: expected ; before: \n: (at row 1)

Row 1:
Column 0,   name: b, type: Float64, parsed text: "2;2"
ERROR: Line feed found where delimiter (;) is expected. It's like your file has less columns than expected.
And if your file have right number of columns, maybe it have unescaped quotes in values.

, e.what() = DB::Exception

Второй пример

echo "2;2;2;2;2;2;2;2;2;2;2;2;2;2;2" |  clickhouse-local  --input-format "CSV"  --format_csv_delimiter ';' -S "b Float64, c Int64" -q "select * from table"
Code: 27, e.displayText() = DB::Exception: Cannot parse input: expected ; before: \n: (at row 1)

Row 1:
Column 0,   name: b, type: Float64, parsed text: "2;2;2;2;2;2;2;2;2;2;2;2;2;2;2"
ERROR: Line feed found where delimiter (;) is expected. It's like your file has less columns than expected.
And if your file have right number of columns, maybe it have unescaped quotes in values.

, e.what() = DB::Exception
@e11it
Copy link
Author

e11it commented Sep 15, 2018

Проблема появляется при указании опции --format_csv_delimiter , без нее - работает.

Стандартный разделитель

echo -e "1.2,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Float64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table"
1.2     2
3       4

Указали разделитель

echo -e "1;2\n3;4" | clickhouse-local --format_csv_delimiter ';'  -q "CREATE TABLE table (a Float64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table"
Code: 27, e.displayText() = DB::Exception: Cannot parse input: expected ; before: \n3;4\n: (at row 1)

Row 1:
Column 0,   name: a, type: Float64, parsed text: "1;2"
ERROR: Line feed found where delimiter (;) is expected. It's like your file has less columns than expected.
And if your file have right number of columns, maybe it have unescaped quotes in values.

, e.what() = DB::Exception

@alexey-milovidov
Copy link
Member

In master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants