SqlFunctions#addMonths use DateTimeUtils#ymdToUnixDate to calculate the JDN(julian day number). But in some corner cases it yields incorrent results. The root cause is: the algorithm of DateTimeUtils#ymdToUnixDate requires reasonable month(1 to 12), but SqlFunctions#addMonths may pass in a month out of the reasonable range.
BTW: I didn't find the reference of the original paper of the algorithm, but an jdn explanation. Please correct me if anyone can find the original paper.
The following case can reproduce the bug:
addMonth('2019-09-01', 6) should yield '2020-03-01'