Skip to content

[Go] NewTable() and NewTableFromRecords() should return values using arrow.Table interface, not internal *simpleTable (etc.) #40261

@gtomitsuka

Description

@gtomitsuka

Describe the enhancement requested

Currently, the definitions in Go's arrow/array are inconsistent. Most table-related methods (e.g., AddColumn() or TableFromJSON()) return tables via the arrow.Table interface, while NewTable, NewTableFromSlice, and NewTableFromColumns return a *simpleTable.

While *simpleTable conforms to the arrow.Table interface, this makes typings harder as it's not immediately obvious whether *simpleTable conforms to arrow.Table, *arrow.Table, or any interface at all; you have to actively look through the types and figure it out yourself, leading to significant wasted time as a developer.
You can't use *simpleTable in function signatures or variables with explicit types, so it's a meaningful DX improvement, leading to better docs and IDE support for Arrow.

Upon further inspection, the same issue applies to two other functions from arrow/array:

  • NewRecord returns *simpleRecord instead of arrow.Record
  • NewRecordReader returns *simpleRecords instead of array.RecordReader

I made those changes locally on a large project and tested it, so I'm confident the changes would be purely cosmetic, not impacting any functionality (which intuitively should be true, since *simpleTable isn't exposed and conforms to all arrow.Table interfaces), though the unit tests should catch that too

I would like to take on this issue and work on it myself, given that contributors agree this would be a meaningful task to work on.

Thank you!

Component(s)

Go

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions