Looking into this further, there is this convertlet that will convert a TIMESTAMP_ADD to a DATETIME_PLUS. https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java#L2132
As part of it, it will convert the amount to add to a unit for DATETIME_PLUS. For example, hours are converted to milliseconds. From there it looks like it will convert this to a "+" operation. https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java#L3718 I didn't see where it adds the two numbers together though. ________________________________ From: Cancai Cai <[email protected]> Sent: Monday, August 26, 2024 8:37 AM To: [email protected] <[email protected]> Subject: Re: Some doubts about date functions Thanks for your reply. Yes, I also located here, and I finally debugged to https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java#L3802 but I don’t know how to continue. I find it hard to believe that https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/util/BuiltInMethod.java#L517 is the processing of the data_add function, because its name is add_months not date_add > 2024年8月26日 23:19,Norman Jordan <[email protected]> 写道: > > this leads to here: > https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/util/BuiltInMethod.java#L517 > [https://opengraph.githubassets.com/6af4884a9b80dd1ac5b81e610caea8c9e34bcc847d0e172706a503b58f4f1557/apache/calcite]<https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/util/BuiltInMethod.java#L517> > calcite/core/src/main/java/org/apache/calcite/util/BuiltInMethod.java at main > ・ Warning: The sender of this message could not be validated and may not be the actual sender.
