I got wrong understanding of the result of WEEKDAY and DAYOFWEEK. Now fix it and add test cases for extract(day_of_month from ts)