|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.akiban.sql.compiler.BooleanNormalizer
public class BooleanNormalizer
Perform normalization such as CNF on boolean expressions.
| Field Summary | |
|---|---|
static int |
NOT_IN_AND_LIMIT
|
| Constructor Summary | |
|---|---|
BooleanNormalizer(SQLParserContext parserContext)
|
|
| Method Summary | |
|---|---|
protected ValueNode |
castToBoolean(ValueNode node)
|
protected ValueNode |
changeToCNF(ValueNode node,
boolean underTopAndNode)
Finish putting an expression into conjunctive normal form. |
void |
conditionalNode(ConditionalNode node)
Normalize WHEN clause in this CASE node. |
protected ValueNode |
eliminateNots(ValueNode node,
boolean underNotNode)
Eliminate NotNodes in the current query block. |
protected ValueNode |
equalsBooleanConstant(ValueNode node,
Boolean constant)
|
protected ValueNode |
getNotEqual(ValueNode left,
ValueNode right)
|
protected ValueNode |
inWithNestedTuples(InListOperatorNode node)
|
void |
joinNode(JoinNode node)
Normalize ON clause in this JOIN node. |
StatementNode |
normalize(StatementNode stmt)
Normalize conditions anywhere in this statement. |
ValueNode |
normalizeExpression(ValueNode boolClause)
Normalize a top-level boolean expression. |
protected AndNode |
putAndsOnTop(ValueNode node)
Do the 1st step in putting an expression into conjunctive normal form. |
void |
selectNode(SelectNode node)
Normalize WHERE clause in this SELECT node. |
boolean |
skipChildren(Visitable node)
Method that is called to indicate whether we should skip all nodes below this node for traversal. |
boolean |
stopTraversal()
Method that is called to see if query tree traversal should be stopped before visiting all nodes. |
protected boolean |
verifyChangeToCNF(ValueNode node,
boolean top)
Verify that changeToCNF() did its job correctly. |
protected boolean |
verifyEliminateNots(ValueNode node)
Verify that eliminateNots() did its job correctly. |
protected boolean |
verifyPutAndsOnTop(ValueNode node)
Verify that putAndsOnTop() did its job correctly. |
Visitable |
visit(Visitable node)
This is the default visit operation on a QueryTreeNode. |
boolean |
visitChildrenFirst(Visitable node)
Method that is called to see if visit() should be called on
the children of node before it is called on node itself. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NOT_IN_AND_LIMIT
| Constructor Detail |
|---|
public BooleanNormalizer(SQLParserContext parserContext)
| Method Detail |
|---|
public StatementNode normalize(StatementNode stmt)
throws StandardException
StandardException
public void selectNode(SelectNode node)
throws StandardException
StandardException
public void joinNode(JoinNode node)
throws StandardException
StandardException
public void conditionalNode(ConditionalNode node)
throws StandardException
StandardException
public ValueNode normalizeExpression(ValueNode boolClause)
throws StandardException
StandardException
protected ValueNode eliminateNots(ValueNode node,
boolean underNotNode)
throws StandardException
node - An expression node.underNotNode - Whether or not we are under a NotNode.
StandardException - Thrown on error
protected ValueNode getNotEqual(ValueNode left,
ValueNode right)
throws StandardException
StandardException
protected ValueNode inWithNestedTuples(InListOperatorNode node)
throws StandardException
StandardException
protected ValueNode castToBoolean(ValueNode node)
throws StandardException
StandardException
protected ValueNode equalsBooleanConstant(ValueNode node,
Boolean constant)
throws StandardException
StandardExceptionprotected boolean verifyEliminateNots(ValueNode node)
protected AndNode putAndsOnTop(ValueNode node)
throws StandardException
node - An expression node.
StandardException - Thrown on errorprotected boolean verifyPutAndsOnTop(ValueNode node)
node - An expression node.
protected ValueNode changeToCNF(ValueNode node,
boolean underTopAndNode)
throws StandardException
node - An expression node.underTopAndNode - Whether or not we are under a top level AndNode.
StandardException - Thrown on error
protected boolean verifyChangeToCNF(ValueNode node,
boolean top)
node - An expression node.
public Visitable visit(Visitable node)
throws StandardException
VisitorVisitors will overload this method by implementing a version with a signature that matches a specific type of node. For example, if I want to do something special with aggregate nodes, then that Visitor will implement a visit(AggregateNode node) method which does the aggregate specific processing.
visit in interface Visitornode - the node to process
StandardException - may be throw an error
as needed by the visitor (i.e. may be a normal error
if a particular node is found, e.g. if checking
a group by, we don't expect to find any ColumnReferences
that aren't under an AggregateNode -- the easiest
thing to do is just throw an error when we find the
questionable node).public boolean visitChildrenFirst(Visitable node)
Visitorvisit() should be called on
the children of node before it is called on node itself.
If this method always returns true, the visitor will walk the
tree bottom-up. If it always returns false, the tree is visited
top-down.
visitChildrenFirst in interface Visitornode - the top node of a sub-tree about to be visited
true if node's children should be visited
before node, false otherwisepublic boolean stopTraversal()
Visitor
stopTraversal in interface Visitor
public boolean skipChildren(Visitable node)
throws StandardException
VisitorDiffers from stopTraversal() in that it only affects subtrees, rather than the entire traversal.
skipChildren in interface Visitornode - the node to process
StandardException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||