-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
I used this orc reader for a project I was working and I wanted to offer an example I needed which helped me. I had nested orc structures I wanted to convert to json. If would like a PR I would be happy to submit to the README.md
// Example 2
r, err := Open("./examples/demo-12-zlib.orc")
if err != nil {
log.Fatal(err)
}
defer r.Close()
rootColumns := r.Schema().Columns()
count := len(rootColumns)
values := make([]interface{}, count)
// Create a new Cursor reading the provided columns.
c := r.Select(rootColumns...)
returnData := make(map[string]interface{})
// Iterate over each stripe in the file.
for c.Stripes() {
// Iterate over each row in the stripe.
for c.Next() {
// Retrieve a slice of interface values for the current row.
log.Println(c.Row())
currentRow := c.Row()
for i, _ := range values {
masterData[rootColumns[i]] = currentRow[i]
}
slicer, _ := json.Marshal(returnData)
fmt.Println(string(slicer))
}
}
if err := c.Err(); err != nil {
log.Fatal(err)
}This is taken from https://github.com/vfrank66/aws-s3-orc-to-kinesis.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels