| java.lang.Object org.apache.derby.impl.sql.compile.QueryTreeNode org.apache.derby.impl.sql.compile.ValueNode org.apache.derby.impl.sql.compile.UnaryOperatorNode
All known Subclasses: org.apache.derby.impl.sql.compile.AggregateNode, org.apache.derby.impl.sql.compile.UnaryComparisonOperatorNode, org.apache.derby.impl.sql.compile.QuantifiedUnaryOperatorNode, org.apache.derby.impl.sql.compile.DB2LengthOperatorNode, org.apache.derby.impl.sql.compile.UnaryArithmeticOperatorNode, org.apache.derby.impl.sql.compile.ExtractOperatorNode, org.apache.derby.impl.sql.compile.UnaryLogicalOperatorNode, org.apache.derby.impl.sql.compile.SimpleStringOperatorNode, org.apache.derby.impl.sql.compile.UnaryDateTimestampOperatorNode, org.apache.derby.impl.sql.compile.LengthOperatorNode,
UnaryOperatorNode | public class UnaryOperatorNode extends ValueNode (Code) | | A UnaryOperatorNode represents a built-in unary operator as defined by
the ANSI/ISO SQL standard. This covers operators like +, -, NOT, and IS NULL.
Java operators are not represented here: the JSQL language allows Java
methods to be called from expressions, but not Java operators.
author: Jeff Lichtman |
Method Summary | |
public Visitable | accept(Visitor v) Accept a visitor, and call v.visit()
on child nodes as necessary. | protected int | addXmlOpMethodParams(ExpressionClassBuilder acb, MethodBuilder mb) Add some additional arguments to our method call for
XML related operations like XMLPARSE and XMLSERIALIZE.
Parameters: mb - The MethodBuilder that will make the call. | public ValueNode | bindExpression(FromList fromList, SubqueryList subqueryList, Vector aggregateVector) Bind this expression. | void | bindParameter() By default unary operators don't accept ? parameters as operands. | protected ValueNode | bindUnaryOperator(FromList fromList, SubqueryList subqueryList, Vector aggregateVector) Workhorse for bindExpression. | public void | bindXMLParse() Bind an XMLPARSE operator. | public void | bindXMLSerialize() Bind an XMLSERIALIZE operator. | public boolean | categorize(JBitSet referencedTabs, boolean simplePredsOnly) Categorize this predicate. | public boolean | constantExpression(PredicateList whereClause) | public void | generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) Do code generation for this unary operator. | public ValueNode | getOperand() Get the operand of this unary operator. | String | getOperatorString() Get the operator of this unary operator. | protected int | getOrderableVariantType() Return the variant type for the underlying expression. | public ParameterNode | getParameterOperand() Get the parameter operand of this unary operator. | public String | getReceiverInterfaceName() Determine the type the binary method is called on. | public void | init(Object operand, Object operatorOrOpType, Object methodNameOrAddedArgs) Initializer for a UnaryOperatorNode. | public void | init(Object operand) | public boolean | isConstantExpression() Return whether or not this expression tree represents a constant expression. | protected boolean | isEquivalent(ValueNode o) | public boolean | isUnaryMinusOrPlusWithParameter() Returns true if this UnaryOperatorNode is for -?/+?. | public ValueNode | preprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList) Preprocess an expression tree. | public void | printSubNodes(int depth) Prints the sub-nodes of this object. | public ValueNode | remapColumnReferencesToExpressions() Remap all ColumnReferences in this tree to be clones of the
underlying expression. | public boolean | requiresTypeFromContext() | public void | setClause(int clause) Set the clause that this node appears in. | void | setMethodName(String methodName) Set the methodName. | void | setOperator(String operator) Set the operator. | public String | toString() Convert this object to a String. |
IS_NULL | final public static int IS_NULL(Code) | | |
NOT | final public static int NOT(Code) | | |
UNARY_MINUS | final public static int UNARY_MINUS(Code) | | |
UNARY_PLUS | final public static int UNARY_PLUS(Code) | | |
UnaryMethodNames | final static String[] UnaryMethodNames(Code) | | |
UnaryResultTypes | final static String[] UnaryResultTypes(Code) | | |
XMLPARSE_OP | final public static int XMLPARSE_OP(Code) | | |
XMLSERIALIZE_OP | final public static int XMLSERIALIZE_OP(Code) | | |
operatorType | int operatorType(Code) | | |
addXmlOpMethodParams | protected int addXmlOpMethodParams(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException(Code) | | Add some additional arguments to our method call for
XML related operations like XMLPARSE and XMLSERIALIZE.
Parameters: mb - The MethodBuilder that will make the call. Number of parameters added. |
bindExpression | public ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, Vector aggregateVector) throws StandardException(Code) | | Bind this expression. This means binding the sub-expressions,
as well as figuring out what the return type is for this expression.
Parameters: fromList - The FROM list for the query thisexpression is in, for binding columns. Parameters: subqueryList - The subquery list being built as we find SubqueryNodes Parameters: aggregateVector - The aggregate vector being built as we find AggregateNodes The new top of the expression tree. exception: StandardException - Thrown on error |
bindParameter | void bindParameter() throws StandardException(Code) | | By default unary operators don't accept ? parameters as operands.
This can be over-ridden for particular unary operators.
We throw an exception if the parameter doesn't have a datatype
assigned to it yet.
exception: StandardException - Thrown if ? parameter doesn'thave a type bound to it yet.? parameter where it isn't allowed. |
bindXMLParse | public void bindXMLParse() throws StandardException(Code) | | Bind an XMLPARSE operator. Makes sure the operand type
is correct, and sets the result type.
exception: StandardException - Thrown on error |
bindXMLSerialize | public void bindXMLSerialize() throws StandardException(Code) | | Bind an XMLSERIALIZE operator. Makes sure the operand type
and target type are both correct, and sets the result type.
exception: StandardException - Thrown on error |
categorize | public boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly) throws StandardException(Code) | | Categorize this predicate. Initially, this means
building a bit map of the referenced tables for each predicate.
If the source of this ColumnReference (at the next underlying level)
is not a ColumnReference or a VirtualColumnNode then this predicate
will not be pushed down.
For example, in:
select * from (select 1 from s) a (x) where x = 1
we will not push down x = 1.
NOTE: It would be easy to handle the case of a constant, but if the
inner SELECT returns an arbitrary expression, then we would have to copy
that tree into the pushed predicate, and that tree could contain
subqueries and method calls.
RESOLVE - revisit this issue once we have views.
Parameters: referencedTabs - JBitSet with bit map of referenced FromTables Parameters: simplePredsOnly - Whether or not to consider methodcalls, field references and conditional nodeswhen building bit map boolean Whether or not source.expression is a ColumnReferenceor a VirtualColumnNode. exception: StandardException - Thrown on error |
getOperand | public ValueNode getOperand()(Code) | | Get the operand of this unary operator.
The operand of this unary operator. |
getOperatorString | String getOperatorString()(Code) | | Get the operator of this unary operator.
The operator of this unary operator. |
getOrderableVariantType | protected int getOrderableVariantType() throws StandardException(Code) | | Return the variant type for the underlying expression.
The variant type can be:
VARIANT - variant within a scan
(method calls and non-static field access)
SCAN_INVARIANT - invariant within a scan
(column references from outer tables)
QUERY_INVARIANT - invariant within the life of a query
(constant expressions)
CONSTANT - immutable
The variant type for the underlying expression. exception: StandardException - thrown on error |
getParameterOperand | public ParameterNode getParameterOperand()(Code) | | Get the parameter operand of this unary operator.
For the example below, for abs unary operator node, we want to get ?
select * from t1 where -? = max_cni(abs(-?), sqrt(+?))
This gets called when ParameterNode is needed to get parameter
specific information like getDefaultValue(), getParameterNumber() etc
The parameter operand of this unary operator else null. |
getReceiverInterfaceName | public String getReceiverInterfaceName() throws StandardException(Code) | | Determine the type the binary method is called on.
By default, based on the receiver.
Override in nodes that use methods on super-interfaces of
the receiver's interface, such as comparisons.
exception: StandardException - Thrown on error |
init | public void init(Object operand, Object operatorOrOpType, Object methodNameOrAddedArgs)(Code) | | Initializer for a UnaryOperatorNode.
Parameters: operand - The operand of the node Parameters: operatorOrOpType - Either 1) the name of the operator,OR 2) an Integer holding the operatorType for this operator. Parameters: methodNameOrAddedArgs - Either 1) name of the methodto call for this operator, or 2) an array of Objectsfrom which primitive method parameters can beretrieved. |
init | public void init(Object operand)(Code) | | Initializer for a UnaryOperatorNode
Parameters: operand - The operand of the node |
isConstantExpression | public boolean isConstantExpression()(Code) | | Return whether or not this expression tree represents a constant expression.
Whether or not this expression tree represents a constant expression. |
isUnaryMinusOrPlusWithParameter | public boolean isUnaryMinusOrPlusWithParameter()(Code) | | Returns true if this UnaryOperatorNode is for -?/+?.
This is required to check -?/+? say in the following sql
select * from t1 where -? and c11=c11 or +?
True if this +?/-? node |
preprocess | public ValueNode preprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList) throws StandardException(Code) | | Preprocess an expression tree. We do a number of transformations
here (including subqueries, IN lists, LIKE and BETWEEN) plus
subquery flattening.
NOTE: This is done before the outer ResultSetNode is preprocessed.
Parameters: numTables - Number of tables in the DML Statement Parameters: outerFromList - FromList from outer query block Parameters: outerSubqueryList - SubqueryList from outer query block Parameters: outerPredicateList - PredicateList from outer query block The modified expression exception: StandardException - Thrown on error |
printSubNodes | public void printSubNodes(int depth)(Code) | | Prints the sub-nodes of this object. See QueryTreeNode.java for
how tree printing is supposed to work.
Parameters: depth - The depth of this node in the tree |
remapColumnReferencesToExpressions | public ValueNode remapColumnReferencesToExpressions() throws StandardException(Code) | | Remap all ColumnReferences in this tree to be clones of the
underlying expression.
ValueNode The remapped expression tree. exception: StandardException - Thrown on error |
setClause | public void setClause(int clause)(Code) | | Set the clause that this node appears in.
Parameters: clause - The clause that this node appears in. |
setMethodName | void setMethodName(String methodName)(Code) | | Set the methodName.
Parameters: methodName - The methodName. |
setOperator | void setOperator(String operator)(Code) | | Set the operator.
Parameters: operator - The operator. |
toString | public String toString()(Code) | | Convert this object to a String. See comments in QueryTreeNode.java
for how this should be done for tree printing.
This object as a String |
Methods inherited from org.apache.derby.impl.sql.compile.ValueNode | public ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, Vector aggregateVector) throws StandardException(Code)(Java Doc) public ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, Vector aggregateVector, boolean forQueryRewrite) throws StandardException(Code)(Java Doc) public boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly) throws StandardException(Code)(Java Doc) public ValueNode changeToCNF(boolean underTopAndNode) throws StandardException(Code)(Java Doc) public ValueNode checkIsBoolean() throws StandardException(Code)(Java Doc) public void checkReliability(String fragmentType, int fragmentBitMask) throws StandardException(Code)(Java Doc) public void checkReliability(int fragmentBitMask, String fragmentType) throws StandardException(Code)(Java Doc) void checkTopPredicatesForEqualsConditions(int tableNumber, boolean[] eqOuterCols, int[] tableNumbers, JBitSet[] tableColMap, boolean resultColTable) throws StandardException(Code)(Java Doc) public boolean constantExpression(PredicateList whereClause)(Code)(Java Doc) public void copyFields(ValueNode oldVN) throws StandardException(Code)(Java Doc) ValueNode eliminateNots(boolean underNotNode) throws StandardException(Code)(Java Doc) public ValueNode genEqualsFalseTree() throws StandardException(Code)(Java Doc) public ValueNode genIsNullTree() throws StandardException(Code)(Java Doc) public ValueNode genSQLJavaSQLTree() throws StandardException(Code)(Java Doc) final protected void generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException(Code)(Java Doc) public void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException(Code)(Java Doc) public void generateFilter(ExpressionClassBuilder ecb, MethodBuilder mb) throws StandardException(Code)(Java Doc) public int getClause()(Code)(Java Doc) public ValueNode getClone() throws StandardException(Code)(Java Doc) public String getColumnName()(Code)(Java Doc) Object getConstantValueAsObject() throws StandardException(Code)(Java Doc) final protected DataValueFactory getDataValueFactory()(Code)(Java Doc) protected int getOrderableVariantType() throws StandardException(Code)(Java Doc) public String getSchemaName() throws StandardException(Code)(Java Doc) public ResultColumn getSourceResultColumn()(Code)(Java Doc) public String getTableName()(Code)(Java Doc) JBitSet getTablesReferenced() throws StandardException(Code)(Java Doc) boolean getTransformed()(Code)(Java Doc) public TypeCompiler getTypeCompiler() throws StandardException(Code)(Java Doc) public TypeId getTypeId() throws StandardException(Code)(Java Doc) public DataTypeDescriptor getTypeServices() throws StandardException(Code)(Java Doc) public void init(Object typeId, Object precision, Object scale, Object isNullable, Object maximumWidth) throws StandardException(Code)(Java Doc) public boolean isBinaryEqualsOperatorNode()(Code)(Java Doc) boolean isBooleanFalse()(Code)(Java Doc) boolean isBooleanTrue()(Code)(Java Doc) public boolean isCloneable()(Code)(Java Doc) public boolean isConstantExpression()(Code)(Java Doc) abstract protected boolean isEquivalent(ValueNode other) throws StandardException(Code)(Java Doc) public boolean isParameterNode()(Code)(Java Doc) public boolean isRelationalOperator()(Code)(Java Doc) final protected boolean isSameNodeType(ValueNode other)(Code)(Java Doc) public boolean optimizableEqualityNode(Optimizable optTable, int columnNumber, boolean isNullOkay) throws StandardException(Code)(Java Doc) public ValueNode preprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList) throws StandardException(Code)(Java Doc) public ValueNode putAndsOnTop() throws StandardException(Code)(Java Doc) public ValueNode remapColumnReferencesToExpressions() throws StandardException(Code)(Java Doc) public boolean requiresTypeFromContext()(Code)(Java Doc) public double selectivity(Optimizable optTable) throws StandardException(Code)(Java Doc) public void setClause(int clause)(Code)(Java Doc) void setTransformed()(Code)(Java Doc) public void setType(DataTypeDescriptor dataTypeServices) throws StandardException(Code)(Java Doc) public String toString()(Code)(Java Doc) public boolean updatableByCursor()(Code)(Java Doc) public boolean verifyChangeToCNF()(Code)(Java Doc) boolean verifyEliminateNots()(Code)(Java Doc) public boolean verifyPutAndsOnTop()(Code)(Java Doc)
|
Methods inherited from org.apache.derby.impl.sql.compile.QueryTreeNode | public Visitable accept(Visitor v) throws StandardException(Code)(Java Doc) public QueryTreeNode bind() throws StandardException(Code)(Java Doc) public DataValueDescriptor convertDefaultNode(DataTypeDescriptor typeDescriptor) throws StandardException(Code)(Java Doc) protected static void debugFlush()(Code)(Java Doc) public static void debugPrint(String outputString)(Code)(Java Doc) public void disablePrivilegeCollection()(Code)(Java Doc) public String executeSchemaName()(Code)(Java Doc) public String executeStatementName()(Code)(Java Doc) public static String formatNodeString(String nodeString, int depth)(Code)(Java Doc) public boolean foundString(String[] list, String search)(Code)(Java Doc) public GeneratedClass generate(ByteArray ignored) throws StandardException(Code)(Java Doc) protected void generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException(Code)(Java Doc) void generateAuthorizeCheck(ActivationClassBuilder acb, MethodBuilder mb, int sqlOperation)(Code)(Java Doc) public int getBeginOffset()(Code)(Java Doc) final protected ClassFactory getClassFactory()(Code)(Java Doc) final protected CompilerContext getCompilerContext()(Code)(Java Doc) final public ContextManager getContextManager()(Code)(Java Doc) public Object getCursorInfo() throws StandardException(Code)(Java Doc) final public DataDictionary getDataDictionary()(Code)(Java Doc) final public DependencyManager getDependencyManager()(Code)(Java Doc) public int getEndOffset()(Code)(Java Doc) final public ExecutionFactory getExecutionFactory()(Code)(Java Doc) final public GenericConstantActionFactory getGenericConstantActionFactory()(Code)(Java Doc) protected int getIntProperty(String value, String key) throws StandardException(Code)(Java Doc) final protected LanguageConnectionContext getLanguageConnectionContext()(Code)(Java Doc) final public NodeFactory getNodeFactory()(Code)(Java Doc) protected int getNodeType()(Code)(Java Doc) public ConstantNode getNullNode(TypeId typeId, ContextManager cm) throws StandardException(Code)(Java Doc) public DataTypeDescriptor[] getParameterTypes() throws StandardException(Code)(Java Doc) public long getRowEstimate()(Code)(Java Doc) public String getSPSName()(Code)(Java Doc) final SchemaDescriptor getSchemaDescriptor(String schemaName) throws StandardException(Code)(Java Doc) final SchemaDescriptor getSchemaDescriptor(String schemaName, boolean raiseError) throws StandardException(Code)(Java Doc) protected int getStatementType()(Code)(Java Doc) final protected TableDescriptor getTableDescriptor(String tableName, SchemaDescriptor schema) throws StandardException(Code)(Java Doc) final protected TypeCompiler getTypeCompiler(TypeId typeId)(Code)(Java Doc) public void init(Object arg1) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11, Object arg12) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13) throws StandardException(Code)(Java Doc) public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14) throws StandardException(Code)(Java Doc) public boolean isAtomic() throws StandardException(Code)(Java Doc) protected boolean isInstanceOf(int nodeType)(Code)(Java Doc) public boolean isPrivilegeCollectionRequired()(Code)(Java Doc) final boolean isSessionSchema(SchemaDescriptor sd)(Code)(Java Doc) final boolean isSessionSchema(String schemaName)(Code)(Java Doc) public ConstantAction makeConstantAction() throws StandardException(Code)(Java Doc) public ResultDescription makeResultDescription() throws StandardException(Code)(Java Doc) public TableName makeTableName(String schemaName, String flatName) throws StandardException(Code)(Java Doc) public boolean needsSavepoint()(Code)(Java Doc) protected String nodeHeader()(Code)(Java Doc) public QueryTreeNode optimize() throws StandardException(Code)(Java Doc) public static QueryTreeNode parseQueryText(CompilerContext compilerContext, String queryText, Object[] paramDefaults, LanguageConnectionContext lcc) throws StandardException(Code)(Java Doc) public void printLabel(int depth, String label)(Code)(Java Doc) public void printSubNodes(int depth)(Code)(Java Doc) public boolean referencesSessionSchema() throws StandardException(Code)(Java Doc) public TableName resolveTableToSynonym(TableName tabName) throws StandardException(Code)(Java Doc) public void setBeginOffset(int beginOffset)(Code)(Java Doc) public void setContextManager(ContextManager cm)(Code)(Java Doc) public void setEndOffset(int endOffset)(Code)(Java Doc) public void setNodeType(int nodeType)(Code)(Java Doc) public void setRefActionInfo(long fkIndexConglomId, int[] fkColArray, String parentResultSetId, boolean dependentScan)(Code)(Java Doc) public String toString()(Code)(Java Doc) public void treePrint()(Code)(Java Doc) public void treePrint(int depth)(Code)(Java Doc) String verifyClassExist(String javaClassName, boolean convertCase) throws StandardException(Code)(Java Doc)
|
|
|