Fix #557. Using group by time(1y) doesn't work while time(365d) is fine