zeroshade commented on code in PR #34343:
URL: https://github.com/apache/arrow/pull/34343#discussion_r1129707589


##########
go/arrow/csv/reader.go:
##########
@@ -731,15 +731,19 @@ func (r *Reader) parseList(field array.Builder, str 
string) {
                field.AppendNull()
                return
        }
-       if !(strings.HasPrefix(str, "{") || strings.HasSuffix(str, "}")) {
+       if !(strings.HasPrefix(str, "{") && strings.HasSuffix(str, "}")) {
                r.err = errors.New("invalid list format. should start with '{' 
and end with '}'")
-               field.AppendNull()
                return
        }
        str = strings.TrimPrefix(str, "{")
        str = strings.TrimSuffix(str, "}")

Review Comment:
   Looking at the implementations from the `strings` package, I'm pretty sure 
that calling `strings.Trim` is more efficient than calling `TrimPrefix` and 
`TrimSuffix` separately. At minimum it reduces the number of code branches that 
get used. Personally I'd prefer using `strings.Trim` over the separate calls to 
prefix/suffix. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to