refactor for ColumnWriter::writeSelectsAsColumns