Walmart CEO Doug McMillon plans to retire early next year, the company said Friday in a surprise announcement.