Skip to content

Commit

Permalink
MINOR: [Go] Add LazyQuotes parsing option to CSV reader (#37304)
Browse files Browse the repository at this point in the history
### Rationale for this change

CSV data could have quotes inside of column data. Go csv package handles this with LazyQuotes flag.
PR adds option to set this flag.

### What changes are included in this PR?

### Are these changes tested?

### Are there any user-facing changes?

Authored-by: Valery Gridnev <[email protected]>
Signed-off-by: Matt Topol <[email protected]>
  • Loading branch information
valri11 authored Aug 23, 2023
1 parent 5fc73e8 commit ee2122b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions go/arrow/csv/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ func WithHeader(useHeader bool) Option {
}
}

// WithLazyQuotes sets csv parsing option to LazyQuotes
func WithLazyQuotes(useLazyQuotes bool) Option {
return func(cfg config) {
switch cfg := cfg.(type) {
case *Reader:
cfg.r.LazyQuotes = useLazyQuotes
default:
panic(fmt.Errorf("arrow/csv: unknown config type %T", cfg))
}
}
}

// DefaultNullValues is the set of values considered as NULL values by default
// when Reader is configured to handle NULL values.
var DefaultNullValues = []string{"", "NULL", "null"}
Expand Down

0 comments on commit ee2122b

Please sign in to comment.