AlwaysZhi opened a new issue, #45:
URL: https://github.com/apache/arrow-go/issues/45

   ### Describe the usage question you have. Please include as many useful 
details as  possible.
   
   
   When I attempt to use the array.RecordFromJSON() method to read a relatively 
large JSON file (approximately 200MB in size), Ithe method does not return for 
a significant amount of time. It seems to be either blocked indefinitely or 
possibly stuck in an ongoing data processing loop. I am currently unable to 
determine whether this is a bug or how to successfully utilize the method to 
achieve my objective.
   Here is my code:
   
   func readJsonFile() {
        schema := arrow.NewSchema([]arrow.Field{
                {Name: "instruction", Type: arrow.BinaryTypes.String, Nullable: 
true},
                {Name: "input", Type: arrow.BinaryTypes.String, Nullable: true},
                {Name: "output", Type: arrow.BinaryTypes.String, Nullable: 
true},
        }, nil)
        jsonFile, err := os.Open("/home/data/mydata.json")
        if err != nil {
                fmt.Println("open json file:", err)
                return
        }
        defer jsonFile.Close()
        mem := memory.NewCheckedAllocator(memory.DefaultAllocator)
        rec, _, err := array.RecordFromJSON(mem, schema, jsonFile)
        fmt.Printf("record number is: %d", rec.NumRows())
        fmt.Println("field name 0 -", rec.Schema().Field(0).Name)
        fmt.Println("field name 1 -", rec.Schema().Field(1).Name)
        fmt.Println("field name 2 -", rec.Schema().Field(2).Name)
   }
   
   My json file format looks like this:
   [{"instruction":"a", "input":"b", "output","o1"}, {"instruction":"c", 
"input":"d", "output","o2"}, ...]
   
   ### Component(s)
   
   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