Kane Williamson returned to Test cricket after missing the three-match series against India but was dismissed seven runs short of his 33rd century at Christchurch.