$ echo "1 2" | clickhouse-local -S "a int, b int" --input-format="CSV" --format_csv_delimiter=' ' -q "select * from table"
Code: 27, e.displayText() = DB::Exception: Cannot parse input: expected before: 2\n: (at row 1)
Row 1:
Column 0, name: a, type: Int32, parsed text: "1"
ERROR: There is no delimiter ( ). "2" found instead.
(version 19.13.1.1)
Also, the expected before could use some quoting.
BTW, we cannot support any delimiter that may happen to be parsed as part of value.
For example . is not supported as a delimiter, because we cannot determine, what 1.2 is.
But this is another issue: we support padding by spaces and skip spaces around values unconditionally* (before parsing delimiter). Better to introduce a setting... and probably turn it off automatically when delimiter is space.
* - this contradicts RFC.
It can be done with CustomSeparated format:
$ echo "1 2" | clickhouse-local -S "a int, b int" --input-format=CustomSeparated --format_custom_escaping_rule=CSV --format_custom_field_delimiter=' ' -q "select * from table"
1 2
We should add an error message about unsupported delimiters, and maybe mention CustomSeparated.
It's just so annoying when a simple thing breaks for unknown reasons with a cryptic message, and the user has no idea what's wrong and how it can be fixed.
I'm not woking on this now, so I'll remove myself from the assignees list.
Most helpful comment
It can be done with
CustomSeparatedformat: