Randall O'Reilly created ARROW-4388:
---------------------------------------

             Summary: [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


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
(v7.6.3#76005)

Reply via email to