-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Fix applying settings for FORMAT on the client #46003
Conversation
f7933d5
to
e45577b
Compare
And now you can see the "reason" why it was written that way, after this patch the following query changes their behavior: $ echo 'Custom true' | clickhouse-local -q "SELECT * FROM file('/dev/stdin', 'TSV', 'bool Bool') settings bool_true_representation='Custom true'"
Custom true Before this PR But, with this PR now client interpret Also here are few other variants without this patch, that may looks odd: $ echo 'Custom true' | ch local -q "SELECT * FROM file('/dev/stdin', 'TSV', 'bool Bool') format TSV settings bool_true_representation='Custom true'"
Custom true
$ echo 'Custom true' | ch local -q "SELECT * FROM file('/dev/stdin', 'TSV', 'bool Bool')" --bool_true_representation='Custom true'
Custom true |
@tavplubix @Avogar or maybe @alexey-milovidov maybe you have some thoughts on this? To me it looks odd that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the new behavior more than the old one, thank you!
I think we can simply update the tests |
Previously the following query does not works correctly: SELECT number FROM numbers(5) SETTINGS output_format_json_array_of_rows = 1 FORMAT JSONEachRow While this one works OK: SELECT number FROM numbers(5) FORMAT JSONEachRow SETTINGS output_format_json_array_of_rows = 1 The problem is in which AST those settings are stored, use the logic as executeQuery() has to apply them: https://github.com/ClickHouse/ClickHouse/blob/c83f701696451c5bbd856d5f5503ba1553388e5d/src/Interpreters/executeQuery.cpp#L467-L497 Note, the only problem should be with the settings for FORMAT, since client applies thoes settings (and formats) locally w/o server, while in case of i.e. HTTP it will be applied on the server and everything will works fine. Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
I am a bit worried about serialization vs deserialization. But OK, let's try. |
Refernce files had been checked manually and using this onelinear: $ diff <(jq -r .bool ../tests/queries/0_stateless/02152_bool_type_parsing.stdout) ../tests/queries/0_stateless/02152_bool_type_parsing.reference Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
e45577b
to
eded2b8
Compare
Integration tests (asan) [3/6] - #45437 |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix applying settings for FORMAT on the client
Previously the following query does not works correctly:
While this one works OK:
The problem is in which AST those settings are stored, use the logic as executeQuery() has to apply them:
ClickHouse/src/Interpreters/executeQuery.cpp
Lines 467 to 497 in c83f701
Note, the only problem should be with the settings for FORMAT, since client applies thoes settings (and formats) locally w/o server, while in case of i.e. HTTP it will be applied on the server and everything will works fine.
Refs: #45880 (cc @tavplubix @m1khal3v)
Follow-up for: #12480