zeroshade commented on code in PR #34343:
URL: https://github.com/apache/arrow/pull/34343#discussion_r1120470176
##########
go/arrow/csv/reader.go:
##########
@@ -721,6 +734,39 @@ func (r *Reader) parseDecimal256(field array.Builder, str
string, prec, scale in
field.(*array.Decimal256Builder).Append(val)
}
+func (r *Reader) parseList(field array.Builder, str string) {
+ if r.isNull(str) {
+ field.AppendNull()
+ return
+ }
+ 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, "}")
+ strs := strings.Split(str, ",")
+ if len(strs) == 0 {
+ field.AppendNull()
+ return
+ }
+ listBldr := field.(*array.ListBuilder)
+ listBldr.Append(true)
+ valueBldr := listBldr.ValueBuilder()
+ for _, str := range strs {
+ r.initFieldConverter(valueBldr)(str)
+ }
+}
+
+func (r *Reader) parseFixedSizeBinary(field array.Builder, str string,
byteWidth int) {
+ if r.isNull(str) {
+ field.AppendNull()
+ return
+ }
+ field.(*array.FixedSizeBinaryBuilder).Append([]byte(str))
+}
Review Comment:
I'd argue we probably want to make sure that any solution to allow the
customization of the behavior *should* default to just calling the underlying
storage type if there is no customized version available.
It might make sense to allow providing a custom marshaller / unmarshaller
when constructing the Array Type or the ExtensionType itself? And then just
defaulting to the underlying storage if that custom one is nil? Thoughts?
--
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]