|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ compile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.sql.compile
Class ValueNodeList

java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.QueryTreeNodeVector
org.apache.derby.impl.sql.compile.ValueNodeList
- All Implemented Interfaces:
- org.apache.derby.iapi.sql.compile.Visitable
- public class ValueNodeList
- extends QueryTreeNodeVector
A ValueNodeList represents a list of ValueNodes within a specific predicate (eg, IN list, NOT IN list or BETWEEN) in a DML statement. It extends QueryTreeNodeVector.
| Field Summary |
| Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset |
| Constructor Summary | |
ValueNodeList()
|
|
| Method Summary | |
org.apache.derby.iapi.sql.compile.Visitable |
accept(org.apache.derby.iapi.sql.compile.Visitor v)
Accept a visitor, and call v.visit() on child nodes as necessary. |
void |
addElement(QueryTreeNode qt)
|
void |
addValueNode(ValueNode valueNode)
Add a ValueNode to the list. |
(package private) boolean |
allSamePrecendence(int precedence)
Return whether or not all of the entries in the list have the same type precendence as the specified value. |
void |
bindExpression(FromList fromList,
SubqueryList subqueryList,
java.util.Vector aggregateVector)
Bind this expression. |
boolean |
categorize(org.apache.derby.iapi.util.JBitSet referencedTabs,
boolean simplePredsOnly)
Categorize this predicate. |
void |
comparable(ValueNode leftOperand)
Determine whether or not the leftOperand is comparable() with all of the elements in the list. |
void |
compatible(ValueNode leftOperand)
Make sure that passed ValueNode's type is compatible with the non-parameter elements in the ValueNodeList. |
boolean |
constantExpression(PredicateList whereClause)
|
boolean |
containsAllConstantNodes()
Does this list contain all ConstantNodes? |
boolean |
containsAllParameterNodes()
Does this list contain all ParameterNodes? |
boolean |
containsParameterNode()
Does this list contain a ParameterNode? |
void |
destructiveAppend(QueryTreeNodeVector qtnv)
|
QueryTreeNode |
elementAt(int index)
|
void |
genSQLJavaSQLTrees()
Generate a SQL->Java->SQL conversion tree any node in the list which is not a system built-in type. |
org.apache.derby.iapi.types.DataTypeDescriptor |
getDominantTypeServices()
Get the dominant DataTypeServices from the elements in the list. |
protected int |
getOrderableVariantType()
Return the variant type for the underlying expression. |
org.apache.derby.iapi.types.DataTypeDescriptor |
getTypeServices()
Get the first non-null DataTypeServices from the elements in the list. |
(package private) int |
indexOf(QueryTreeNode qt)
|
(package private) void |
insertElementAt(QueryTreeNode qt,
int index)
|
boolean |
isConstantExpression()
Return whether or not this expression tree represents a constant expression. |
boolean |
isNullable()
Determine whether or not any of the elements in the list are nullable. |
void |
nondestructiveAppend(QueryTreeNodeVector qtnv)
|
void |
preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
Preprocess a ValueNodeList. |
void |
printSubNodes(int depth)
Prints the sub-nodes of this object. |
ValueNodeList |
remapColumnReferencesToExpressions()
Remap all ColumnReferences in this tree to be clones of the underlying expression. |
(package private) java.lang.Object |
remove(int index)
|
(package private) void |
removeAllElements()
|
(package private) void |
removeElement(QueryTreeNode qt)
|
(package private) void |
removeElementAt(int index)
|
void |
setClause(int clause)
Set the clause that this node appears in. |
(package private) void |
setElementAt(QueryTreeNode qt,
int index)
|
void |
setParameterDescriptor(org.apache.derby.iapi.types.DataTypeDescriptor descriptor)
Set the descriptor for every ParameterNode in the list. |
int |
size()
|
(package private) void |
sortInAscendingOrder(org.apache.derby.iapi.types.DataValueDescriptor judgeODV)
Sort the entries in the list in ascending order. |
java.lang.String |
toString()
Format this list as a string We can simply iterate through the list. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
ValueNodeList
public ValueNodeList()
| Method Detail |
printSubNodes
public void printSubNodes(int depth)
- Prints the sub-nodes of this object. See QueryTreeNode.java for
how tree printing is supposed to work.
- Overrides:
printSubNodesin classQueryTreeNode
setClause
public void setClause(int clause)
- Set the clause that this node appears in.
addValueNode
public void addValueNode(ValueNode valueNode) throws org.apache.derby.iapi.error.StandardException
- Add a ValueNode to the list.
bindExpression
public void bindExpression(FromList fromList, SubqueryList subqueryList, java.util.Vector aggregateVector) throws org.apache.derby.iapi.error.StandardException
- Bind this expression. This means binding the sub-expressions,
as well as figuring out what the return type is for this expression.
genSQLJavaSQLTrees
public void genSQLJavaSQLTrees()
throws org.apache.derby.iapi.error.StandardException
- Generate a SQL->Java->SQL conversion tree any node in the list
which is not a system built-in type.
This is useful when doing comparisons, built-in functions, etc. on
java types which have a direct mapping to system built-in types.
getDominantTypeServices
public org.apache.derby.iapi.types.DataTypeDescriptor getDominantTypeServices() throws org.apache.derby.iapi.error.StandardException
- Get the dominant DataTypeServices from the elements in the list.
getTypeServices
public org.apache.derby.iapi.types.DataTypeDescriptor getTypeServices() throws org.apache.derby.iapi.error.StandardException
- Get the first non-null DataTypeServices from the elements in the list.
allSamePrecendence
boolean allSamePrecendence(int precedence)
- Return whether or not all of the entries in the list have the same
type precendence as the specified value.
compatible
public void compatible(ValueNode leftOperand) throws org.apache.derby.iapi.error.StandardException
- Make sure that passed ValueNode's type is compatible with the non-parameter elements in the ValueNodeList.
comparable
public void comparable(ValueNode leftOperand) throws org.apache.derby.iapi.error.StandardException
- Determine whether or not the leftOperand is comparable() with all of
the elements in the list. Throw an exception if any of them are not
comparable.
isNullable
public boolean isNullable()
- Determine whether or not any of the elements in the list are nullable.
containsParameterNode
public boolean containsParameterNode()
- Does this list contain a ParameterNode?
containsAllParameterNodes
public boolean containsAllParameterNodes()
- Does this list contain all ParameterNodes?
containsAllConstantNodes
public boolean containsAllConstantNodes()
- Does this list contain all ConstantNodes?
sortInAscendingOrder
void sortInAscendingOrder(org.apache.derby.iapi.types.DataValueDescriptor judgeODV) throws org.apache.derby.iapi.error.StandardException
- Sort the entries in the list in ascending order.
(All values are assumed to be constants.)
setParameterDescriptor
public void setParameterDescriptor(org.apache.derby.iapi.types.DataTypeDescriptor descriptor) throws org.apache.derby.iapi.error.StandardException
- Set the descriptor for every ParameterNode in the list.
preprocess
public void preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
throws org.apache.derby.iapi.error.StandardException
- Preprocess a ValueNodeList. For now, we just preprocess each ValueNode
in the list.
remapColumnReferencesToExpressions
public ValueNodeList remapColumnReferencesToExpressions() throws org.apache.derby.iapi.error.StandardException
- Remap all ColumnReferences in this tree to be clones of the
underlying expression.
isConstantExpression
public boolean isConstantExpression()
- Return whether or not this expression tree represents a constant expression.
constantExpression
public boolean constantExpression(PredicateList whereClause)
categorize
public boolean categorize(org.apache.derby.iapi.util.JBitSet referencedTabs, boolean simplePredsOnly) throws org.apache.derby.iapi.error.StandardException
- 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.
getOrderableVariantType
protected int getOrderableVariantType()
throws org.apache.derby.iapi.error.StandardException
- 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 - constant
size
public final int size()
elementAt
public QueryTreeNode elementAt(int index)
addElement
public final void addElement(QueryTreeNode qt)
removeElementAt
final void removeElementAt(int index)
removeElement
final void removeElement(QueryTreeNode qt)
remove
final java.lang.Object remove(int index)
indexOf
final int indexOf(QueryTreeNode qt)
setElementAt
final void setElementAt(QueryTreeNode qt, int index)
destructiveAppend
public void destructiveAppend(QueryTreeNodeVector qtnv)
nondestructiveAppend
public void nondestructiveAppend(QueryTreeNodeVector qtnv)
removeAllElements
final void removeAllElements()
insertElementAt
final void insertElementAt(QueryTreeNode qt, int index)
toString
public java.lang.String toString()
- Format this list as a string
We can simply iterate through the list. Note each list member
is a QueryTreeNode, and so should have its specialization of
toString defined.
- Overrides:
toStringin classQueryTreeNode
accept
public org.apache.derby.iapi.sql.compile.Visitable accept(org.apache.derby.iapi.sql.compile.Visitor v) throws org.apache.derby.iapi.error.StandardException
- Accept a visitor, and call v.visit()
on child nodes as necessary.
- Specified by:
acceptin interfaceorg.apache.derby.iapi.sql.compile.Visitable- Overrides:
acceptin classQueryTreeNode
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ compile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC