From 2520e535a0b4ccfa712de37139089b7a2ca54fa0 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sun, 24 Feb 2019 06:51:02 -0800 Subject: [PATCH] Allow lazyQuotes for certain types of CSV (#7278) Set lazyQuotes to true, to allow a quote to appear in an unquote field and a non-doubled quote may appear in a quoted field. --- pkg/s3select/csv/reader.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/s3select/csv/reader.go b/pkg/s3select/csv/reader.go index 858fa5a54..bdd7a69b8 100644 --- a/pkg/s3select/csv/reader.go +++ b/pkg/s3select/csv/reader.go @@ -138,6 +138,12 @@ func NewReader(readCloser io.ReadCloser, args *ReaderArgs) (*Reader, error) { csvReader.Comma = []rune(args.FieldDelimiter)[0] csvReader.Comment = []rune(args.CommentCharacter)[0] csvReader.FieldsPerRecord = -1 + // If LazyQuotes is true, a quote may appear in an unquoted field and a + // non-doubled quote may appear in a quoted field. + csvReader.LazyQuotes = true + // If TrimLeadingSpace is true, leading white space in a field is ignored. + // This is done even if the field delimiter, Comma, is white space. + csvReader.TrimLeadingSpace = true r := &Reader{ args: args,