You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/30 10:53:34 UTC

[GitHub] [arrow] forsaken628 opened a new issue, #14780: [Go] Marshal break on map data type with slice

forsaken628 opened a new issue, #14780:
URL: https://github.com/apache/arrow/issues/14780

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   ```
   func TestName2(t *testing.T) {
   	mem := memory.DefaultAllocator
   	dt := arrow.MapOf(arrow.BinaryTypes.String, arrow.BinaryTypes.String)
   	schema := arrow.NewSchema([]arrow.Field{{
   		Name: "map",
   		Type: dt,
   	}}, nil)
   
   	arr, _, err := array.FromJSON(mem, dt, bytes.NewReader(
   		[]byte(`
   [[{"key":"index1","value":"main2"}]
   ,[{"key":"index3","value":"main4"},{"key":"tag_int","value":""}]
   ,[{"key":"index5","value":"main6"},{"key":"tag_int","value":""}]
   ,[{"key":"index6","value":"main7"},{"key":"tag_int","value":""}]
   ,[{"key":"index7","value":"main8"},{"key":"tag_int","value":""}]
   ,[{"key":"index8","value":"main9"}]
   ]`),
   	))
   	if err != nil {
   		panic(err)
   	}
   
   	rec := array.NewRecord(schema, []arrow.Array{arr}, int64(arr.Len()))
   	// rec2 := rec // ok
   	// rec2 := rec.NewSlice(0, 2) // ok
   	rec2 := rec.NewSlice(1, 2)
   
   	var buf bytes.Buffer
   	w := ipc.NewWriter(&buf, ipc.WithSchema(rec.Schema()))
   	err = w.Write(rec2)
   	if err != nil {
   		panic(err)
   	}
   	err = w.Close()
   	if err != nil {
   		panic(err)
   	}
   
   	r, err := ipc.NewReader(&buf)
   	if err != nil {
   		panic(err)
   	}
   
   	r.Next()
   	fmt.Println(r.Record())
   	// record:
   	//  schema:
   	//  fields: 1
   	//    - map: type=map<utf8, utf8>
   	//  rows: 1
   	//  col[0][map]: %!v(PANIC=String method: arrow/array: index out of range)
   }
   ```
   
   ### 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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] zeroshade closed issue #14780: [Go] Marshal break on map data type with slice

Posted by GitBox <gi...@apache.org>.
zeroshade closed issue #14780: [Go] Marshal break on map data type with slice
URL: https://github.com/apache/arrow/issues/14780


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] zeroshade commented on issue #14780: [Go] Marshal break on map data type with slice

Posted by GitBox <gi...@apache.org>.
zeroshade commented on issue #14780:
URL: https://github.com/apache/arrow/issues/14780#issuecomment-1332640779

   i found the issue which was the handling of the offsets for slices when building the IPC values. The attached PR fixes the issue and adds tests for it.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] zeroshade commented on issue #14780: [Go] Marshal break on map data type with slice

Posted by GitBox <gi...@apache.org>.
zeroshade commented on issue #14780:
URL: https://github.com/apache/arrow/issues/14780#issuecomment-1332233580

   Taking a look into this, will comment back soon.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] pitrou commented on issue #14780: [Go] Marshal break on map data type with slice

Posted by GitBox <gi...@apache.org>.
pitrou commented on issue #14780:
URL: https://github.com/apache/arrow/issues/14780#issuecomment-1332009863

   cc @zeroshade 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org