| Modifier and Type | Field and Description |
|---|---|
static int |
NOT_IN_AND_LIMIT |
| Constructor and Description |
|---|
BooleanNormalizer(SQLParserContext parserContext) |
| Modifier and Type | Method and Description |
|---|---|
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)
Method called for each node that is visited.
|
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. |
public static final int NOT_IN_AND_LIMIT
public BooleanNormalizer(SQLParserContext parserContext)
public StatementNode normalize(StatementNode stmt) throws StandardException
StandardExceptionpublic void selectNode(SelectNode node) throws StandardException
StandardExceptionpublic void joinNode(JoinNode node) throws StandardException
StandardExceptionpublic void conditionalNode(ConditionalNode node) throws StandardException
StandardExceptionpublic ValueNode normalizeExpression(ValueNode boolClause) throws StandardException
StandardExceptionprotected ValueNode eliminateNots(ValueNode node, boolean underNotNode) throws StandardException
node - An expression node.underNotNode - Whether or not we are under a NotNode.StandardException - Thrown on errorprotected ValueNode getNotEqual(ValueNode left, ValueNode right) throws StandardException
StandardExceptionprotected ValueNode inWithNestedTuples(InListOperatorNode node) throws StandardException
StandardExceptionprotected ValueNode castToBoolean(ValueNode node) throws StandardException
StandardExceptionprotected 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 errorprotected boolean verifyChangeToCNF(ValueNode node, boolean top)
node - An expression node.public Visitable visit(Visitable node) throws StandardException
Visitorvisit in interface Visitornode - the node to processStandardException - 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 visitedtrue if node's children should be visited
before node, false otherwisepublic boolean stopTraversal()
VisitorstopTraversal in interface Visitorpublic 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 processStandardExceptionCopyright © 2015 FoundationDB, LLC. All rights reserved.