candiduslynx commented on code in PR #35457:
URL: https://github.com/apache/arrow/pull/35457#discussion_r1187601530


##########
go/arrow/array/numericbuilder.gen.go:
##########
@@ -3534,7 +3534,29 @@ func (b *DurationBuilder) AppendValueFromString(s 
string) error {
                b.AppendNull()
                return nil
        }
-       return fmt.Errorf("%w: AppendValueFromString not implemented for 
Duration", arrow.ErrNotImplemented)
+       var value arrow.Duration
+       var unitStr string
+       n, err := fmt.Sscanf(s, "%d%s", &value, &unitStr)
+       if err != nil {
+               b.AppendNull()
+               return err
+       }
+       if n != 2 {
+               b.AppendNull()
+               return fmt.Errorf("failed to parse Duration from %q", s)
+       }
+
+       // to ns & back
+       unit, err := arrow.TimeUnitFromString(unitStr)
+       if err != nil {
+               b.AppendNull()
+               return err
+       }
+
+       value *= arrow.Duration(unit.Multiplier())
+       value /= arrow.Duration(b.dtype.Unit.Multiplier())
+
+       b.Append(value)

Review Comment:
   Possibly, I could (as the ValueStr should only provide the `ns, us, ms, s` 
suffixes. I'll give it a go



-- 
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