def get_const(tab):
    """
    Finds cols in `tab` whose values are constant (same everywhere).

    A table with zero rows has no const cols.  A table with one row has all
    const cols.

    @return
      A mapping from col name to constant value, for cols whose arrays have
      the same value in every index.
    """
    const = dict()
    if tab.num_rows == 0:
        return const
    for name, arr in tab.arrs.items():
        val = arr[0]
        if (arr == val).all():
            const[name] = val
    return const
