Class SqlDatetimeSubtractionOperator

java.lang.Object
org.apache.calcite.sql.SqlOperator
org.apache.calcite.sql.SqlSpecialOperator
org.apache.calcite.sql.fun.SqlDatetimeSubtractionOperator

public class SqlDatetimeSubtractionOperator extends SqlSpecialOperator
A special operator for the subtraction of two DATETIMEs. The format of DATETIME subtraction is:
"(" <datetime> "-" <datetime> ")" <interval qualifier>

This operator is special since it needs to hold the additional interval qualifier specification, when in SqlCall form. In RexNode form, it has only two parameters, and the return type describes the desired type of interval.

When being used for BigQuery's TIMESTAMP_SUB, TIME_SUB, and DATE_SUB operators, this operator subtracts an interval value from a timestamp value. The return type differs due to differing number of parameters and ordering. This is accounted for by passing in a SqlReturnTypeInference which is passed in by the standard MINUS_DATE and the library MINUS_DATE2 operators at their respective initializations.