zeroshade commented on issue #804:
URL: https://github.com/apache/arrow-go/issues/804#issuecomment-4398312846

   Ah, it looks like the string handling expects it to be in the form "3h2m5s" 
etc. for go's `ParseDuration` rather than being a number, that's why it fails 
in the string case.
   
   Using `WithUseNumber` does fix the first case though.
   
   ```go
   package main
   
   import (
        "bytes"
        "fmt"
        "log"
   
        "github.com/apache/arrow-go/v18/arrow"
        "github.com/apache/arrow-go/v18/arrow/array"
        "github.com/apache/arrow-go/v18/arrow/memory"
   )
   
   func main() {
        mem := memory.DefaultAllocator
        dt := arrow.FixedWidthTypes.Duration_s
        record, _, err := array.FromJSON(mem, dt, 
bytes.NewReader([]byte("[9223372036854775807]")), array.WithUseNumber())
        if err != nil {
                log.Fatal(err)
        }
        fmt.Println(record)
   }
   ```
   
   ```
   [9223372036854775807]
   ```
   


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