Sandoval's HR in 10th gives Giants 3-2 win over Diamondbacks