Package org.apache.calcite.sql.fun
Class SqlFloorFunction
- java.lang.Object
-
- org.apache.calcite.sql.SqlOperator
-
- org.apache.calcite.sql.SqlFunction
-
- org.apache.calcite.sql.fun.SqlMonotonicUnaryFunction
-
- org.apache.calcite.sql.fun.SqlFloorFunction
-
public class SqlFloorFunction extends SqlMonotonicUnaryFunction
Definition of the "FLOOR" and "CEIL" built-in SQL functions.
-
-
Field Summary
-
Fields inherited from class org.apache.calcite.sql.SqlOperator
kind, MDX_PRECEDENCE, NL
-
-
Constructor Summary
Constructors Constructor Description SqlFloorFunction(SqlKind kind)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SqlMonotonicity
getMonotonicity(SqlOperatorBinding call)
Returns whether a call to this operator is monotonic.static SqlCall
replaceTimeUnitOperand(SqlCall call, java.lang.String literal, SqlParserPos pos)
Copies aSqlCall
, replacing the time unit operand with the given literal.void
unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec)
Writes a SQL representation of a call to this operator to a writer, including parentheses if the operators on either side are of greater precedence.static void
unparseDatetimeFunction(SqlWriter writer, SqlCall call, java.lang.String funName, java.lang.Boolean datetimeFirst)
Most dialects that natively support datetime floor will use this.-
Methods inherited from class org.apache.calcite.sql.SqlFunction
deriveType, getFunctionType, getNameAsId, getParamNames, getParamTypes, getSqlIdentifier, getSyntax, isQuantifierAllowed, validateCall, validateQuantifier
-
Methods inherited from class org.apache.calcite.sql.SqlOperator
acceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getName, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, leftPrec, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperands
-
-
-
-
Constructor Detail
-
SqlFloorFunction
public SqlFloorFunction(SqlKind kind)
-
-
Method Detail
-
getMonotonicity
public SqlMonotonicity getMonotonicity(SqlOperatorBinding call)
Description copied from class:SqlOperator
Returns whether a call to this operator is monotonic.Default implementation returns
SqlMonotonicity.NOT_MONOTONIC
.- Overrides:
getMonotonicity
in classSqlMonotonicUnaryFunction
- Parameters:
call
- Call to this operator with particular arguments and information about the monotonicity of the arguments
-
unparse
public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec)
Description copied from class:SqlOperator
Writes a SQL representation of a call to this operator to a writer, including parentheses if the operators on either side are of greater precedence.The default implementation of this method delegates to
SqlSyntax.unparse(org.apache.calcite.sql.SqlWriter, org.apache.calcite.sql.SqlOperator, org.apache.calcite.sql.SqlCall, int, int)
.- Overrides:
unparse
in classSqlFunction
-
replaceTimeUnitOperand
public static SqlCall replaceTimeUnitOperand(SqlCall call, java.lang.String literal, SqlParserPos pos)
Copies aSqlCall
, replacing the time unit operand with the given literal.- Parameters:
call
- Callliteral
- Literal to replace time unit withpos
- Parser position- Returns:
- Modified call
-
unparseDatetimeFunction
public static void unparseDatetimeFunction(SqlWriter writer, SqlCall call, java.lang.String funName, java.lang.Boolean datetimeFirst)
Most dialects that natively support datetime floor will use this. In those cases the call will look like TRUNC(datetime, 'year').- Parameters:
writer
- SqlWritercall
- SqlCallfunName
- Name of the sql function to calldatetimeFirst
- Specify the order of the datetime & timeUnit arguments
-
-