[ https://issues.apache.org/jira/browse/ARROW-4388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17661410#comment-17661410 ]
Rok Mihevc commented on ARROW-4388: ----------------------------------- This issue has been migrated to [issue #20954|https://github.com/apache/arrow/issues/20954] on GitHub. Please see the [migration documentation|https://github.com/apache/arrow/issues/14542] for further details. > [Go] add DimNames() method to tensor Interface? > ----------------------------------------------- > > Key: ARROW-4388 > URL: https://issues.apache.org/jira/browse/ARROW-4388 > Project: Apache Arrow > Issue Type: Improvement > Components: Go > Affects Versions: 0.12.0 > Reporter: Randall O'Reilly > Assignee: Anson Qian > Priority: Major > Labels: easyfix, pull-request-available > Fix For: 0.13.0 > > Original Estimate: 5m > Time Spent: 3h 20m > Remaining Estimate: 0h > > It would be convenient to get access to the entire slice of dimension names > via a DimNames() []string method, in addition to the existing DimName(i int) > string method. Here is a patch: > > {{--- a/go/arrow/tensor/tensor.go}} > {{+++ b/go/arrow/tensor/tensor.go}} > {{@@ -52,6 +52,9 @@ type Interface interface {}} > {{ // DimName returns the name of the i-th dimension.}} > {{ DimName(i int) string}} > {{+ // DimNames returns the full slice of dimension names.}} > {{+ DimNames() []string}} > {{+}} > {{ DataType() arrow.DataType}} > {{ Data() *array.Data}} > {{@@ -102,6 +105,7 @@ func (tb *tensorBase) Shape() []int64 \{ return > tb.shape }}} > {{ func (tb *tensorBase) Strides() []int64 \{ return tb.strides }}} > {{ func (tb *tensorBase) NumDims() int \{ return len(tb.shape) }}} > {{ func (tb *tensorBase) DimName(i int) string \{ return tb.names[i] }}} > {{+func (tb *tensorBase) DimNames() []string \{ return tb.names }}} > {{ func (tb *tensorBase) DataType() arrow.DataType \{ return tb.dtype }}} > {{ func (tb *tensorBase) Data() *array.Data \{ return tb.data }}} > -- This message was sent by Atlassian Jira (v8.20.10#820010)