com.akiban.sql.parser
Class JoinNode

java.lang.Object
  extended by com.akiban.sql.parser.QueryTreeNode
      extended by com.akiban.sql.parser.ResultSetNode
          extended by com.akiban.sql.parser.FromTable
              extended by com.akiban.sql.parser.JoinNode
All Implemented Interfaces:
Visitable
Direct Known Subclasses:
FullOuterJoinNode, HalfOuterJoinNode

public class JoinNode
extends FromTable

A JoinNode represents a join result set for either of the basic DML operations: SELECT and INSERT. For INSERT - SELECT, any of the fields in a JoinNode can be used (the JoinNode represents the (join) SELECT statement in the INSERT - SELECT). For INSERT, the resultColumns in the selectList will contain the names of the columns being inserted into or updated.


Nested Class Summary
static class JoinNode.JoinType
           
 
Field Summary
protected  ResultSetNode leftResultSet
           
protected  ResultSetNode rightResultSet
           
 
Fields inherited from class com.akiban.sql.parser.FromTable
correlationName, origTableName, tableProperties
 
Fields inherited from class com.akiban.sql.parser.QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
 
Constructor Summary
JoinNode()
           
 
Method Summary
 void copyFrom(QueryTreeNode node)
          Fill this node with a deep copy of the given node.
 String getExposedName()
          Return the exposed name for this table, which is the name that can be used to refer to this table in the rest of the query.
 ValueNode getJoinClause()
           
 ResultSetNode getLeftmostResultSet()
           
 ResultSetNode getLeftResultSet()
          Get the leftResultSet from this node.
 ResultSetNode getLogicalLeftResultSet()
          Return the logical left result set for this qualified join node.
 ResultSetNode getLogicalRightResultSet()
          Return the logical right result set for this qualified join node.
 ResultSetNode getRightResultSet()
          Get the rightResultSet from this node.
 ResultColumnList getUsingClause()
           
 void init(Object leftResultSet, Object rightResultSet, Object tableProperties)
          Initializer for a TableOperatorNode.
 void init(Object leftResult, Object rightResult, Object onClause, Object usingClause, Object selectList, Object tableProperties, Object joinOrderStrategyProperties)
          Initializer for a JoinNode.
 boolean isNaturalJoin()
          Is this a natural join?
static String joinTypeToString(JoinNode.JoinType joinType)
          Convert the joinType to a string.
 void printSubNodes(int depth)
          Prints the sub-nodes of this object.
 void setJoinClause(ValueNode joinClause)
           
 void setLeftmostResultSet(ResultSetNode newLeftResultSet)
           
 void setLeftResultSet(ResultSetNode leftResultSet)
           
 void setNestedInParens(boolean nestedInParens)
          Mark whether or not this node is nested in parens.
 void setRightResultSet(ResultSetNode rightResultSet)
           
 void setUsingClause(ResultColumnList usingClause)
           
 String toString()
          Convert this object to a String.
 
Methods inherited from class com.akiban.sql.parser.FromTable
getCorrelationName, getOrigTableName, getTableName, init, setCorrelationName, setOrigTableName
 
Methods inherited from class com.akiban.sql.parser.ResultSetNode
getResultColumns, setInsertSource, setResultColumns
 
Methods inherited from class com.akiban.sql.parser.QueryTreeNode
accept, convertDefaultNode, debugFlush, debugPrint, formatNodeString, getBeginOffset, getDebugOutput, getEndOffset, getNodeFactory, getNodeType, getNullNode, getParserContext, getStatementType, getUserData, init, init, init, init, init, init, init, init, init, init, init, isInstanceOf, makeTableName, makeTableName, nodeHeader, printLabel, setBeginOffset, setDebugOutput, setEndOffset, setNodeType, setParserContext, setUserData, stackPrint, treePrint, treePrint, treePrint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

leftResultSet

protected ResultSetNode leftResultSet

rightResultSet

protected ResultSetNode rightResultSet
Constructor Detail

JoinNode

public JoinNode()
Method Detail

init

public void init(Object leftResult,
                 Object rightResult,
                 Object onClause,
                 Object usingClause,
                 Object selectList,
                 Object tableProperties,
                 Object joinOrderStrategyProperties)
          throws StandardException
Initializer for a JoinNode.

Overrides:
init in class QueryTreeNode
Parameters:
leftResult - The ResultSetNode on the left side of this join
rightResult - The ResultSetNode on the right side of this join
onClause - The ON clause
usingClause - The USING clause
selectList - The result column list for the join
tableProperties - Properties list associated with the table
joinOrderStrategyProperties - User provided optimizer overrides
Throws:
StandardException - Thrown on error

copyFrom

public void copyFrom(QueryTreeNode node)
              throws StandardException
Fill this node with a deep copy of the given node.

Throws:
StandardException

joinTypeToString

public static String joinTypeToString(JoinNode.JoinType joinType)
Convert the joinType to a string.

Parameters:
joinType - The joinType as an enum.
Returns:
String The joinType as a String.

getJoinClause

public ValueNode getJoinClause()

setJoinClause

public void setJoinClause(ValueNode joinClause)

getUsingClause

public ResultColumnList getUsingClause()

setUsingClause

public void setUsingClause(ResultColumnList usingClause)

toString

public String toString()
Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing.

Returns:
This object as a String

printSubNodes

public void printSubNodes(int depth)
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

isNaturalJoin

public boolean isNaturalJoin()
Is this a natural join?


getLogicalLeftResultSet

public ResultSetNode getLogicalLeftResultSet()
Return the logical left result set for this qualified join node. (For RIGHT OUTER JOIN, the left is the right and the right is the left and the JOIN is the NIOJ).


getLogicalRightResultSet

public ResultSetNode getLogicalRightResultSet()
Return the logical right result set for this qualified join node. (For RIGHT OUTER JOIN, the left is the right and the right is the left and the JOIN is the NIOJ).


init

public void init(Object leftResultSet,
                 Object rightResultSet,
                 Object tableProperties)
          throws StandardException
Initializer for a TableOperatorNode.

Overrides:
init in class QueryTreeNode
Parameters:
leftResultSet - The ResultSetNode on the left side of this node
rightResultSet - The ResultSetNode on the right side of this node
tableProperties - Properties list associated with the table
Throws:
StandardException - Thrown on error

getLeftResultSet

public ResultSetNode getLeftResultSet()
Get the leftResultSet from this node.

Returns:
ResultSetNode The leftResultSet from this node.

getRightResultSet

public ResultSetNode getRightResultSet()
Get the rightResultSet from this node.

Returns:
ResultSetNode The rightResultSet from this node.

setLeftResultSet

public void setLeftResultSet(ResultSetNode leftResultSet)

setRightResultSet

public void setRightResultSet(ResultSetNode rightResultSet)

getLeftmostResultSet

public ResultSetNode getLeftmostResultSet()

setLeftmostResultSet

public void setLeftmostResultSet(ResultSetNode newLeftResultSet)

getExposedName

public String getExposedName()
Return the exposed name for this table, which is the name that can be used to refer to this table in the rest of the query.

Overrides:
getExposedName in class FromTable
Returns:
The exposed name for this table.

setNestedInParens

public void setNestedInParens(boolean nestedInParens)
Mark whether or not this node is nested in parens. (Useful to parser since some trees get created left deep and others right deep.) The resulting state of this cal was never used so its field was removed to save runtimespace for this node. Further cleanup can be done including parser changes if this call is really nor required.

Parameters:
nestedInParens - Whether or not this node is nested in parens.


Copyright © 2013 Akiban Technologies, Inc. All rights reserved.