[5.0] chunk function improved

adding $columns param to chunk function is good for joined tables and defining columns if we want.
Could this be fixed in a different pull please? Is this also present in 4.2? If so, please send that fix to 4.2.