RFC: localize_cols and localize_rows

RFC: localize_cols localize_rows

Introduction

MatrixTable is enriched with

  • ds.localize_cols(f1, f2, …) – which returns a row-indexed KeyTable with the row fields plus new fields f1, f2, … which are arrays of the corresponding column-indexed fields from the original matrix table
  • ds.localize_rows(f1, f2, …) – the transposition of the above

Motivation

Users often want random access to columns or rows. When the dimension is small, this is sensible, but verbose.

Issues

For each field, should we return an array (whose order is undefined) or a dictionary from column key to value?

Implementation

ds.localize_cols(f1, f2, ...)

can be implemented as:

ds.annotate_rows(f1 = agg.collect(f1), f2 = agg.collect(f2), ...)
  .rows_table()