Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-4388

[Go] add DimNames() method to tensor Interface?

    XMLWordPrintableJSON

Details

    Description

      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 }}}

       

      Attachments

        Issue Links

          Activity

            People

              anson627 Anson Qian
              rcoreilly Randall O'Reilly
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 5m Original Estimate - 5m
                  5m
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 20m
                  3h 20m