Class UnaryDateTimestampOperatorNode
java.lang.Object
org.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.ValueNode
org.apache.derby.impl.sql.compile.OperatorNode
org.apache.derby.impl.sql.compile.UnaryOperatorNode
org.apache.derby.impl.sql.compile.UnaryDateTimestampOperatorNode
- All Implemented Interfaces:
Visitable
This class implements the timestamp( x) and date(x) functions.
These two functions implement a few special cases of string conversions beyond the normal string to
date/timestamp casts.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String(package private) static final int(package private) static final int(package private) final intThis class is used to hold logically different objects for space efficiency.private static final StringFields inherited from class UnaryOperatorNode
K_BASE, K_XMLPARSE, K_XMLSERIALIZE, methodName, operand, operator, receiverInterfaceType, resultInterfaceType, UnaryArgTypes, UnaryMethodNames, UnaryOperators, UnaryResultTypesFields inherited from class ValueNode
transformedFields inherited from class QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX -
Constructor Summary
ConstructorsConstructorDescriptionUnaryDateTimestampOperatorNode(ValueNode operand, int kind, ContextManager cm) -
Method Summary
Modifier and TypeMethodDescription(package private) ValueNodebindExpression(FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates) Called by UnaryOperatorNode.bindExpression.(package private) voidDo code generation for this unary operator.private void(package private) booleanSome node classes represent several logical node types (to reduce footprint), which we call kinds.Methods inherited from class UnaryOperatorNode
acceptChildren, addXmlOpMethodParams, bindOperand, bindParameter, categorize, constantExpression, getOperand, getOperatorString, getOrderableVariantType, getParameterOperand, getReceiverInterfaceName, isConstantExpression, isEquivalent, preprocess, printSubNodes, remapColumnReferencesToExpressions, setMethodName, setOperator, toStringMethods inherited from class OperatorNode
pushSqlXmlUtilMethods inherited from class ValueNode
bindExpression, changeToCNF, checkIsBoolean, checkTopPredicatesForEqualsConditions, copyFields, eliminateNots, evaluateConstantExpressions, genEqualsFalseTree, generate, genIsNullTree, genSQLJavaSQLTree, getClone, getColumnName, getConstantValueAsObject, getDataValueFactory, getSchemaName, getSourceResultColumn, getTableName, getTablesReferenced, getTransformed, getTypeCompiler, getTypeId, getTypeServices, isBinaryEqualsOperatorNode, isBooleanFalse, isBooleanTrue, isCloneable, isInListProbeNode, isParameterNode, isRelationalOperator, optimizableEqualityNode, putAndsOnTop, requiresTypeFromContext, selectivity, setCollationInfo, setCollationInfo, setCollationUsingCompilationSchema, setCollationUsingCompilationSchema, setNullability, setTransformed, setType, setType, setType, updatableByCursor, verifyChangeToCNF, verifyEliminateNots, verifyPutAndsOnTopMethods inherited from class QueryTreeNode
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getLongProperty, getNullNode, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, getUDTDesc, isAtomic, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, treePrint, treePrint, verifyClassExist
-
Field Details
-
TIMESTAMP_METHOD_NAME
- See Also:
-
DATE_METHOD_NAME
- See Also:
-
K_DATE
static final int K_DATE- See Also:
-
K_TIMESTAMP
static final int K_TIMESTAMP- See Also:
-
kind
final int kindThis class is used to hold logically different objects for space efficiency.kindrepresents the logical object type. See alsoValueNode.isSameNodeKind(ValueNode).
-
-
Constructor Details
-
UnaryDateTimestampOperatorNode
UnaryDateTimestampOperatorNode(ValueNode operand, int kind, ContextManager cm) throws StandardException - Parameters:
operand- The operand of the functionkind- The kind of the result, Date or Timestamp.cm- context manager- Throws:
StandardException
-
-
Method Details
-
bindExpression
ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates) throws StandardException Called by UnaryOperatorNode.bindExpression. If the operand is a constant then evaluate the function at compile time. Otherwise, if the operand input type is the same as the output type then discard this node altogether. If the function is "date" and the input is a timestamp then change this node to a cast.- Overrides:
bindExpressionin classUnaryOperatorNode- Parameters:
fromList- The FROM list for the query this expression is in, for binding columns.subqueryList- The subquery list being built as we find SubqueryNodesaggregates- The aggregate list being built as we find AggregateNodes- Returns:
- The new top of the expression tree.
- Throws:
StandardException- Thrown on error
-
invalidOperandType
- Throws:
StandardException
-
generateExpression
Do code generation for this unary operator.- Overrides:
generateExpressionin classUnaryOperatorNode- Parameters:
acb- The ExpressionClassBuilder for the class we're generatingmb- The method the expression will go into- Throws:
StandardException- Thrown on error
-
isSameNodeKind
Description copied from class:ValueNodeSome node classes represent several logical node types (to reduce footprint), which we call kinds. This means that implementations ofValueNode.isEquivalent(ValueNode)cannot always just useinstanceofto check if the other node represents the same kind. Hence this method needs to be overridden by all node classes that represent several kinds. This default implementation does not look at kinds. It is only called from implementations ofisEquivalent.- Overrides:
isSameNodeKindin classUnaryOperatorNode- Parameters:
o- The other value node whose kind we want to compare with.- Returns:
trueifthisandorepresent the same logical node type, i.e. kind.
-