Java Doc for ValueNode.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » sql » compile » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.sql.compile 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.impl.sql.compile.QueryTreeNode
      org.apache.derby.impl.sql.compile.ValueNode

All known Subclasses:   org.apache.derby.impl.sql.compile.ResultColumn,  org.apache.derby.impl.sql.compile.CurrentDatetimeOperatorNode,  org.apache.derby.impl.sql.compile.TernaryOperatorNode,  org.apache.derby.impl.sql.compile.UnaryOperatorNode,  org.apache.derby.impl.sql.compile.ParameterNode,  org.apache.derby.impl.sql.compile.BinaryOperatorNode,  org.apache.derby.impl.sql.compile.SpecialFunctionNode,  org.apache.derby.impl.sql.compile.ConstantNode,  org.apache.derby.impl.sql.compile.JavaToSQLValueNode,  org.apache.derby.impl.sql.compile.ColumnReference,  org.apache.derby.impl.sql.compile.VirtualColumnNode,  org.apache.derby.impl.sql.compile.BinaryListOperatorNode,  org.apache.derby.impl.sql.compile.CastNode,  org.apache.derby.impl.sql.compile.BaseColumnNode,  org.apache.derby.impl.sql.compile.ConditionalNode,  org.apache.derby.impl.sql.compile.CurrentRowLocationNode,  org.apache.derby.impl.sql.compile.DefaultNode,  org.apache.derby.impl.sql.compile.CoalesceFunctionNode,  org.apache.derby.impl.sql.compile.SubqueryNode,
ValueNode
abstract public class ValueNode extends QueryTreeNode (Code)
A ValueNode is an abstract class for all nodes that can represent data values, that is, constants, columns, and expressions.
author:
   Jeff Lichtman


Field Summary
final public static  intIN_HAVING_CLAUSE
    
final public static  intIN_SELECT_LIST
    
final public static  intIN_UNKNOWN_CLAUSE
    
final public static  intIN_WHERE_CLAUSE
    
protected  intclause
    
protected  DataTypeDescriptordataTypeServices
    
 booleantransformed
    

Constructor Summary
public  ValueNode()
    
 ValueNode(Object tcf, Object typeId, Object isNullable, Object maximumWidth)
     Initializer for non-numeric types.

Method Summary
public  ValueNodebindExpression(FromList fromList, SubqueryList subqueryList, Vector aggregateVector)
    
public  ValueNodebindExpression(FromList fromList, SubqueryList subqueryList, Vector aggregateVector, boolean forQueryRewrite)
     Bind this expression.
public  booleancategorize(JBitSet referencedTabs, boolean simplePredsOnly)
     Categorize this predicate.
public  ValueNodechangeToCNF(boolean underTopAndNode)
     Finish putting an expression into conjunctive normal form.
public  ValueNodecheckIsBoolean()
     Bind time logic.
public  voidcheckReliability(String fragmentType, int fragmentBitMask)
     Bind time logic.
public  voidcheckReliability(int fragmentBitMask, String fragmentType)
     Bind time logic.
 voidcheckTopPredicatesForEqualsConditions(int tableNumber, boolean[] eqOuterCols, int[] tableNumbers, JBitSet[] tableColMap, boolean resultColTable)
     Update the array of columns in = conditions with expressions without column references from the same table.
public  booleanconstantExpression(PredicateList whereClause)
     Return whether or not this expression tree represents a constant value. In this case, "constant" means that it will always evaluate to the same thing, even if it includes columns.
public  voidcopyFields(ValueNode oldVN)
     Copy all of the "appropriate fields" for a shallow copy.
 ValueNodeeliminateNots(boolean underNotNode)
     Eliminate NotNodes in the current query block.
public  ValueNodegenEqualsFalseTree()
     Transform this into this = false.
public  ValueNodegenIsNullTree()
     Transform this into this is null.
public  ValueNodegenSQLJavaSQLTree()
     Generate a SQL->Java->SQL conversion tree above the current node and bind the new nodes individually. This is useful when doing comparisons, built-in functions, etc.
final protected  voidgenerate(ActivationClassBuilder acb, MethodBuilder mb)
     Do the code generation for this node.
public  voidgenerateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
     Generate code for this calculation.
public  voidgenerateFilter(ExpressionClassBuilder ecb, MethodBuilder mb)
     The only reason this routine exists is so that I don't have to change the protection on generateExpression() and rototill all of QueryTree.
public  intgetClause()
     Get the clause that this node appears in.
public  ValueNodegetClone()
     Return a clone of this node.
public  StringgetColumnName()
     This is null so that the caller will substitute in the resultset generated name as needed.
 ObjectgetConstantValueAsObject()
     Return an Object representing the bind time value of this expression tree.
final protected  DataValueFactorygetDataValueFactory()
    
protected  intgetOrderableVariantType()
     Return the variant type for the underlying expression.
public  StringgetSchemaName()
     This returns the user-supplied schema name of the column. At this class level, it simply returns null.
public  ResultColumngetSourceResultColumn()
     Get the source for this ValueNode.
public  StringgetTableName()
     This returns the user-supplied table name of the column. At this class level, it simply returns null.
 JBitSetgetTablesReferenced()
    
 booleangetTransformed()
     Return whether or not this predicate has been transformed.
public  TypeCompilergetTypeCompiler()
     Get the TypeCompiler from this ValueNode, based on its TypeId.
public  TypeIdgetTypeId()
     Get the TypeId from this ValueNode. The TypeId from this ValueNode.
public  DataTypeDescriptorgetTypeServices()
     Get the DataTypeServices from this ValueNode. The DataTypeServices from this ValueNode.
public  voidinit(Object typeId, Object precision, Object scale, Object isNullable, Object maximumWidth)
     Initializer for numeric types.
public  booleanisBinaryEqualsOperatorNode()
     Returns true if this value node is a equals operator.
 booleanisBooleanFalse()
     Does this represent a false constant.
 booleanisBooleanTrue()
     Does this represent a true constant.
public  booleanisCloneable()
     Return whether or not this expression tree is cloneable.
public  booleanisConstantExpression()
     Return whether or not this expression tree represents a constant expression.
abstract protected  booleanisEquivalent(ValueNode other)
     Tests if this node is equivalent to the specified ValueNode.
public  booleanisParameterNode()
     Returns TRUE if this is a parameter node.
public  booleanisRelationalOperator()
     Returns true if this ValueNode is a relational operator.
final protected  booleanisSameNodeType(ValueNode other)
     Tests if this node is of the same type as the specified node as reported by QueryTreeNode.getNodeType .
Parameters:
  other - the node to compare this value node against.
public  booleanoptimizableEqualityNode(Optimizable optTable, int columnNumber, boolean isNullOkay)
     Return true if the predicate represents an optimizable equality node. an expression is considered to be an optimizable equality node if all the following conditions are met:
  1. the operator is an = or IS NULL operator
  2. one of the operands is a column specified by optTable/columnNumber
  3. Both operands are not the same column; i.e tab.col = tab.col
  4. There are no implicit varchar comparisons of the operands; i.e either both operands are string like (varchar, char, longvarchar) or neither operand is string like

Parameters:
  optTable - the table being optimized.
public  ValueNodepreprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList)
     Preprocess an expression tree.
public  ValueNodeputAndsOnTop()
     Do the 1st step in putting an expression into conjunctive normal form.
public  ValueNoderemapColumnReferencesToExpressions()
     Remap all ColumnReferences in this tree to be clones of the underlying expression.
public  booleanrequiresTypeFromContext()
     Returns TRUE if the type of this node will be determined from the context in which it is getting used.
public  doubleselectivity(Optimizable optTable)
     The default selectivity for value nodes is 50%.
public  voidsetClause(int clause)
     Set the clause that this node appears in.
 voidsetTransformed()
     Mark this predicate has having been transformed (other predicates were generated from it).
public  voidsetType(DataTypeDescriptor dataTypeServices)
     Set the DataTypeServices for this ValueNode.
public  StringtoString()
     Convert this object to a String.
public  booleanupdatableByCursor()
    
public  booleanverifyChangeToCNF()
     Verify that changeToCNF() did its job correctly.
 booleanverifyEliminateNots()
     Verify that eliminateNots() did its job correctly.
public  booleanverifyPutAndsOnTop()
     Verify that putAndsOnTop() did its job correctly.

Field Detail
IN_HAVING_CLAUSE
final public static int IN_HAVING_CLAUSE(Code)



IN_SELECT_LIST
final public static int IN_SELECT_LIST(Code)



IN_UNKNOWN_CLAUSE
final public static int IN_UNKNOWN_CLAUSE(Code)



IN_WHERE_CLAUSE
final public static int IN_WHERE_CLAUSE(Code)



clause
protected int clause(Code)



dataTypeServices
protected DataTypeDescriptor dataTypeServices(Code)



transformed
boolean transformed(Code)




Constructor Detail
ValueNode
public ValueNode()(Code)



ValueNode
ValueNode(Object tcf, Object typeId, Object isNullable, Object maximumWidth) throws StandardException(Code)
Initializer for non-numeric types.
Parameters:
  tcf - The factory to get theDataTypeServicesFactory from
Parameters:
  typeId - The TypeID of this new node
Parameters:
  isNullable - The nullability of this new node
Parameters:
  maximumWidth - The maximum width of this new node
exception:
  StandardException -




Method Detail
bindExpression
public ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, Vector aggregateVector) throws StandardException(Code)



bindExpression
public ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, Vector aggregateVector, boolean forQueryRewrite) throws StandardException(Code)
Bind this expression. This is a place-holder method - it should never be called.
Parameters:
  fromList - The FROM list to use for binding
Parameters:
  subqueryList - The SubqueryList we are building as we hitSubqueryNodes.
Parameters:
  aggregateVector - The aggregate vector being built as we find AggregateNodes The new top of the expression tree.
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



changeToCNF
public ValueNode changeToCNF(boolean underTopAndNode) throws StandardException(Code)
Finish putting an expression into conjunctive normal form. An expression tree in conjunctive normal form meets the following criteria: o If the expression tree is not null, the top level will be a chain of AndNodes terminating in a true BooleanConstantNode. o The left child of an AndNode will never be an AndNode. o Any right-linked chain that includes an AndNode will be entirely composed of AndNodes terminated by a true BooleanConstantNode. o The left child of an OrNode will never be an OrNode. o Any right-linked chain that includes an OrNode will be entirely composed of OrNodes terminated by a false BooleanConstantNode. o ValueNodes other than AndNodes and OrNodes are considered leaf nodes for purposes of expression normalization. In other words, we won't do any normalization under those nodes. In addition, we track whether or not we are under a top level AndNode. SubqueryNodes need to know this for subquery flattening.
Parameters:
  underTopAndNode - Whether or not we are under a top level AndNode. The modified expression
exception:
  StandardException - Thrown on error



checkIsBoolean
public ValueNode checkIsBoolean() throws StandardException(Code)
Bind time logic. Raises an error if this ValueNode does not resolve to a boolean value. This method is called by WHERE clauses. bound coercion of this node to a builtin type as necessary
exception:
  StandardException - Thrown on error



checkReliability
public void checkReliability(String fragmentType, int fragmentBitMask) throws StandardException(Code)
Bind time logic. Raises an error if this ValueNode, once compiled, returns unstable results AND if we're in a context where unstable results are forbidden. Called by children who may NOT appear in the WHERE subclauses of ADD TABLE clauses.
Parameters:
  fragmentType - Type of fragment as a String, for inclusion in error messages.
Parameters:
  fragmentBitMask - Type of fragment as a bitmask of possible fragment types
exception:
  StandardException - Thrown on error



checkReliability
public void checkReliability(int fragmentBitMask, String fragmentType) throws StandardException(Code)
Bind time logic. Raises an error if this ValueNode, once compiled, returns unstable results AND if we're in a context where unstable results are forbidden. Called by children who may NOT appear in the WHERE subclauses of ADD TABLE clauses.
Parameters:
  fragmentBitMask - Type of fragment as a bitmask of possible fragment types
Parameters:
  fragmentType - Type of fragment as a String, to be fetch for the error message.
exception:
  StandardException - Thrown on error



checkTopPredicatesForEqualsConditions
void checkTopPredicatesForEqualsConditions(int tableNumber, boolean[] eqOuterCols, int[] tableNumbers, JBitSet[] tableColMap, boolean resultColTable) throws StandardException(Code)
Update the array of columns in = conditions with expressions without column references from the same table. This is useful when doing subquery flattening on the basis of an equality condition. eqOuterCols or tableColMap may be null if the calling routine doesn't need the information provided
Parameters:
  tableNumber - The tableNumber of the table from whichthe columns of interest come from.
Parameters:
  eqOuterCols - Array of booleans for noting which columnsare in = predicates without columns from thesubquery block. May be null.
Parameters:
  tableNumbers - Array of table numbers in this query block.
Parameters:
  tableColMap - Array of bits for noting which columnsare in = predicates for each table in thequery block. May be null.
Parameters:
  resultColTable - True if tableNumber is the table containing resultcolumns
exception:
  StandardException - Thrown on error



constantExpression
public boolean constantExpression(PredicateList whereClause)(Code)
Return whether or not this expression tree represents a constant value. In this case, "constant" means that it will always evaluate to the same thing, even if it includes columns. A column is constant if it is compared to a constant expression. True means this expression tree represents a constant value.



copyFields
public void copyFields(ValueNode oldVN) throws StandardException(Code)
Copy all of the "appropriate fields" for a shallow copy.
Parameters:
  oldVN - The ValueNode to copy from.



eliminateNots
ValueNode eliminateNots(boolean underNotNode) throws StandardException(Code)
Eliminate NotNodes in the current query block. We traverse the tree, inverting ANDs and ORs and eliminating NOTs as we go. We stop at ComparisonOperators and boolean expressions. We invert ComparisonOperators and replace boolean expressions with boolean expression = false. NOTE: Since we do not recurse under ComparisonOperators, there still could be NotNodes left in the tree.
Parameters:
  underNotNode - Whether or not we are under a NotNode. The modified expression
exception:
  StandardException - Thrown on error



genEqualsFalseTree
public ValueNode genEqualsFalseTree() throws StandardException(Code)
Transform this into this = false. Useful for NOT elimination. The modified expression
exception:
  StandardException - Thrown on error



genIsNullTree
public ValueNode genIsNullTree() throws StandardException(Code)
Transform this into this is null. Useful for NOT elimination. The modified expression
exception:
  StandardException - Thrown on error



genSQLJavaSQLTree
public ValueNode genSQLJavaSQLTree() throws StandardException(Code)
Generate a SQL->Java->SQL conversion tree above the current node and bind the new nodes individually. This is useful when doing comparisons, built-in functions, etc. on java types which have a direct mapping to system built-in types. ValueNode The new tree.
exception:
  StandardException - Thrown on error



generate
final protected void generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException(Code)
Do the code generation for this node. Call the more general routine that generates expressions.
Parameters:
  acb - The ActivationClassBuilder for the class being built
Parameters:
  mb - The method the expression will go into
exception:
  StandardException - Thrown on error



generateExpression
public void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException(Code)
Generate code for this calculation. This is a place-holder method - it should not be called.
Parameters:
  acb - The ExpressionClassBuilder for the class being built
Parameters:
  mb - The method the expression will go into
exception:
  StandardException - Thrown on error



generateFilter
public void generateFilter(ExpressionClassBuilder ecb, MethodBuilder mb) throws StandardException(Code)
The only reason this routine exists is so that I don't have to change the protection on generateExpression() and rototill all of QueryTree.
Parameters:
  ecb - The ExpressionClassBuilder for the class being built
Parameters:
  mb - The method the expression will go into
exception:
  StandardException - Thrown on error



getClause
public int getClause()(Code)
Get the clause that this node appears in. int The clause that this node appears in.



getClone
public ValueNode getClone() throws StandardException(Code)
Return a clone of this node. ValueNode A clone of this node.
exception:
  StandardException - Thrown on error



getColumnName
public String getColumnName()(Code)
This is null so that the caller will substitute in the resultset generated name as needed. the default column name for an expression -- null.



getConstantValueAsObject
Object getConstantValueAsObject() throws StandardException(Code)
Return an Object representing the bind time value of this expression tree. If the expression tree does not evaluate to a constant at bind time then we return null. This is useful for bind time resolution of VTIs. RESOLVE: What do we do for primitives? An Object representing the bind time value of this expression tree.(null if not a bind time constant.)
exception:
  StandardException - Thrown on error



getDataValueFactory
final protected DataValueFactory getDataValueFactory()(Code)
Return the DataValueFactory



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) The variant type for the underlying expression.
exception:
  StandardException - Thrown on error



getSchemaName
public String getSchemaName() throws StandardException(Code)
This returns the user-supplied schema name of the column. At this class level, it simply returns null. But, the subclasses of ValueNode will overwrite this method to return the user-supplied schema name. When the value node is in a result column of a select list, the user can request metadata information. The result column won't have a column descriptor, so we return some default information through the expression. This lets expressions that are simply columns return all of the info, and others use this supertype's default values. the default schema name for an expression -- null



getSourceResultColumn
public ResultColumn getSourceResultColumn()(Code)
Get the source for this ValueNode. The source of this ValueNode.



getTableName
public String getTableName()(Code)
This returns the user-supplied table name of the column. At this class level, it simply returns null. But, the subclasses of ValueNode will overwrite this method to return the user-supplied table name. When the value node is in a result column of a select list, the user can request metadata information. The result column won't have a column descriptor, so we return some default information through the expression. This lets expressions that are simply columns return all of the info, and others use this supertype's default values. the default table name for an expression -- null



getTablesReferenced
JBitSet getTablesReferenced() throws StandardException(Code)
Get a bit map of table references in this expression A bit map of table numbers referred to in this expression
exception:
  StandardException - Thrown on error



getTransformed
boolean getTransformed()(Code)
Return whether or not this predicate has been transformed. Whether or not this predicate has been transformed.



getTypeCompiler
public TypeCompiler getTypeCompiler() throws StandardException(Code)
Get the TypeCompiler from this ValueNode, based on its TypeId. This ValueNode's TypeCompiler



getTypeId
public TypeId getTypeId() throws StandardException(Code)
Get the TypeId from this ValueNode. The TypeId from this ValueNode. Thismay be null if the node isn't bound yet.



getTypeServices
public DataTypeDescriptor getTypeServices() throws StandardException(Code)
Get the DataTypeServices from this ValueNode. The DataTypeServices from this ValueNode. Thismay be null if the node isn't bound yet.



init
public void init(Object typeId, Object precision, Object scale, Object isNullable, Object maximumWidth) throws StandardException(Code)
Initializer for numeric types.
Parameters:
  typeId - The TypeID of this new node
Parameters:
  precision - The precision of this new node
Parameters:
  scale - The scale of this new node
Parameters:
  isNullable - The nullability of this new node
Parameters:
  maximumWidth - The maximum width of this new node
exception:
  StandardException -



isBinaryEqualsOperatorNode
public boolean isBinaryEqualsOperatorNode()(Code)
Returns true if this value node is a equals operator.
See Also:   ValueNode.isRelationalOperator



isBooleanFalse
boolean isBooleanFalse()(Code)
Does this represent a false constant. Whether or not this node represents a false constant.



isBooleanTrue
boolean isBooleanTrue()(Code)
Does this represent a true constant. Whether or not this node represents a true constant.



isCloneable
public boolean isCloneable()(Code)
Return whether or not this expression tree is cloneable. boolean Whether or not this expression tree is cloneable.



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.



isEquivalent
abstract protected boolean isEquivalent(ValueNode other) throws StandardException(Code)
Tests if this node is equivalent to the specified ValueNode. Two ValueNodes are considered equivalent if they will evaluate to the same value during query execution.

This method provides basic expression matching facility for the derived class of ValueNode and it is used by the language layer to compare the node structural form of the two expressions for equivalence at bind phase.

Note that it is not comparing the actual row values at runtime to produce a result; hence, when comparing SQL NULLs, they are considered to be equivalent and not unknown.

One usage case of this method in this context is to compare the select column expression against the group by expression to check if they are equivalent. e.g.:

SELECT c1+c2 FROM t1 GROUP BY c1+c2

In general, node equivalence is determined by the derived class of ValueNode. But they generally abide to the rules below:

  • The two ValueNodes must be of the same node type to be considered equivalent. e.g.: CastNode vs. CastNode - equivalent (if their args also match), ColumnReference vs CastNode - not equivalent.
  • If node P contains other ValueNode(s) and so on, those node(s) must also be of the same node type to be considered equivalent.
  • If node P takes a parameter list, then the number of arguments and its arguments for the two nodes must also match to be considered equivalent. e.g.: CAST(c1 as INTEGER) vs CAST(c1 as SMALLINT), they are not equivalent.
  • When comparing SQL NULLs in this context, they are considered to be equivalent.
  • If this does not apply or it is determined that the two nodes are not equivalent then the derived class of this method should return false; otherwise, return true.

Parameters:
  other - the node to compare this ValueNode against. true if the two nodes are equivalent, false otherwise.
throws:
  StandardException -



isParameterNode
public boolean isParameterNode()(Code)
Returns TRUE if this is a parameter node. We do lots of special things with Parameter Nodes.



isRelationalOperator
public boolean isRelationalOperator()(Code)
Returns true if this ValueNode is a relational operator. Relational Operators are <, <=, =, >, >=, <> as well as IS NULL and IS NOT NULL. This is the preferred way of figuring out if a ValueNode is relational or not.
See Also:   RelationalOperator
See Also:   BinaryRelationalOperatorNode
See Also:   IsNullNode



isSameNodeType
final protected boolean isSameNodeType(ValueNode other)(Code)
Tests if this node is of the same type as the specified node as reported by QueryTreeNode.getNodeType .
Parameters:
  other - the node to compare this value node against. true if the two nodes are of the same type.



optimizableEqualityNode
public boolean optimizableEqualityNode(Optimizable optTable, int columnNumber, boolean isNullOkay) throws StandardException(Code)
Return true if the predicate represents an optimizable equality node. an expression is considered to be an optimizable equality node if all the following conditions are met:
  1. the operator is an = or IS NULL operator
  2. one of the operands is a column specified by optTable/columnNumber
  3. Both operands are not the same column; i.e tab.col = tab.col
  4. There are no implicit varchar comparisons of the operands; i.e either both operands are string like (varchar, char, longvarchar) or neither operand is string like

Parameters:
  optTable - the table being optimized. Column reference must be fromthis table.
Parameters:
  columnNumber - the column number. One of the operands of thispredicate must be the column number specified by optTable/columnNumber
Parameters:
  isNullOkay - if set to true we also consider IS NULL predicates;otherwise consider only = predicates.



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



putAndsOnTop
public ValueNode putAndsOnTop() throws StandardException(Code)
Do the 1st step in putting an expression into conjunctive normal form. This step ensures that the top level of the expression is a chain of AndNodes. The modified expression
exception:
  StandardException - Thrown on error



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



requiresTypeFromContext
public boolean requiresTypeFromContext()(Code)
Returns TRUE if the type of this node will be determined from the context in which it is getting used. Whether this node's type will be determined from the context



selectivity
public double selectivity(Optimizable optTable) throws StandardException(Code)
The default selectivity for value nodes is 50%. This is overridden in specific cases, such as the RelationalOperators.



setClause
public void setClause(int clause)(Code)
Set the clause that this node appears in.
Parameters:
  clause - The clause that this node appears in.



setTransformed
void setTransformed()(Code)
Mark this predicate has having been transformed (other predicates were generated from it). This will help us with ensure that the predicate does not get calculated into the selectivity multiple times.



setType
public void setType(DataTypeDescriptor dataTypeServices) throws StandardException(Code)
Set the DataTypeServices for this ValueNode. This method is overridden in ParameterNode.
Parameters:
  dataTypeServices - The DataTypeServices to set in thisValueNode



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



updatableByCursor
public boolean updatableByCursor()(Code)
the default updatability for an expression - false



verifyChangeToCNF
public boolean verifyChangeToCNF()(Code)
Verify that changeToCNF() did its job correctly. Verify that: o AndNode - rightOperand is not instanceof OrNode leftOperand is not instanceof AndNode o OrNode - rightOperand is not instanceof AndNode leftOperand is not instanceof OrNode Boolean which reflects validity of the tree.



verifyEliminateNots
boolean verifyEliminateNots()(Code)
Verify that eliminateNots() did its job correctly. Verify that there are no NotNodes above the top level comparison operators and boolean expressions. Boolean which reflects validity of the tree.



verifyPutAndsOnTop
public boolean verifyPutAndsOnTop()(Code)
Verify that putAndsOnTop() did its job correctly. Verify that the top level of the expression is a chain of AndNodes. Boolean which reflects validity of the tree.



Fields inherited from org.apache.derby.impl.sql.compile.QueryTreeNode
final public static int AUTOINCREMENT_CREATE_MODIFY(Code)(Java Doc)
final public static int AUTOINCREMENT_INC_INDEX(Code)(Java Doc)
final public static int AUTOINCREMENT_IS_AUTOINCREMENT_INDEX(Code)(Java Doc)
final public static int AUTOINCREMENT_START_INDEX(Code)(Java Doc)
boolean isPrivilegeCollectionRequired(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)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.