Fix incorrect rank value in data splitting

Fix #6990.