-
Notifications
You must be signed in to change notification settings - Fork 88
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
Using tsv reader #114
Using tsv reader #114
Conversation
@@ -81,6 +82,15 @@ func (r *textRows) Next(dest []driver.Value) error { | |||
return err | |||
} | |||
|
|||
// skip row before WITH TOTALS, | |||
// not but do not skip an empty line if it is part of the result |
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.
please elaborate a little more. I don't quite understand the meaning
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.
If we read a line that contains nothing (condition len(row) == 1 && row[0] == ""
), then two options are possible:
-
SELECT query ''
We need to keep this line as part of the output:
Let's check that we requested one item
len(dest)! = 1
- the condition is not met, do not skip this data -
This is a line break in queries like WITH TOTALS, WITH CUBE, WITH ROLLUP, where the aggregated part is separated from the main empty line:
It is important that such queries require groupings:WITH TOTALS, ROLLUP or CUBE are not supported without aggregation
In such queries, there will be more than one column, or it will not be empty. We skip this line in the results.
@@ -54,7 +54,7 @@ func TestTextRows(t *testing.T) { | |||
} | |||
|
|||
func TestTextRowsQuoted(t *testing.T) { | |||
buf := bytes.NewReader([]byte("text\nArray(String)\n['Quote: \"here\"']")) | |||
buf := bytes.NewReader([]byte("text\nArray(String)\n['Quote: \"here\"']\n")) |
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.
Does clickhouse return the data with a trailing \n? if not we should leave the tests as is
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.
yes, clickhouse output with the TabSeparatedWithNamesAndTypes format ends with \n
Hi! Thanks for PR. |
Thanks for the great work! |
Reading lines as TSV, instead of using CSV.
Fixes bugs
#103
#110