You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fixes#16558 CSV delimiter determiner
* Fixes#16558 - properly determine CSV delmiiter
* Moves quoteString to a new function
* Adds big test with lots of commas for tab delimited csv
* Adds comments
* Shortens the text of the test
* Removes single quotes from regexp as only double quotes need to be searched
* Fixes spelling
* Fixes check of length as it probalby will only be 1e4, not greater
* Makes sample size a const, properly removes truncated line
* Makes sample size a const, properly removes truncated line
* Fixes comment
* Fixes comment
* tests for FormatError() function
* Adds logic to find the limiter before or after a quoted value
* Simplifies regex
* Error tests
* Error tests
* Update modules/csv/csv.go
Co-authored-by: delvh <[email protected]>
* Update modules/csv/csv.go
Co-authored-by: delvh <[email protected]>
* Adds comments
* Update modules/csv/csv.go
Co-authored-by: delvh <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: delvh <[email protected]>
// guessDelimiter takes up to maxLines of the CSV text, iterates through the possible delimiters, and sees if the CSV Reader reads it without throwing any errors.
83
+
// If more than one delimiter passes, the delimiter that results in the most columns is returned.
// Removes quoted values so we don't have columns with new lines in them
91
+
text:=removeQuotedString(string(data))
92
+
93
+
// Make the text just be maxLines or less, ignoring truncated lines
94
+
lines:=strings.SplitN(text, "\n", maxLines+1) // Will contain at least one line, and if there are more than MaxLines, the last item holds the rest of the lines
95
+
iflen(lines) >maxLines {
96
+
// If the length of lines is > maxLines we know we have the max number of lines, trim it to maxLines
0 commit comments