using scala reflection for converting row-wise storage to columnar