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,
java.lang.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. |
public static final int NOT_IN_AND_LIMIT
public BooleanNormalizer(SQLParserContext parserContext)
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 errorprotected 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, java.lang.Boolean constant) throws StandardException
StandardException
protected 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
Visitor
Visitors 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 Visitor
node
- 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)
Visitor
visit()
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 Visitor
node
- the top node of a sub-tree about to be visitedtrue
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
Visitor
Differs from stopTraversal() in that it only affects subtrees, rather than the entire traversal.
skipChildren
in interface Visitor
node
- the node to processStandardException
Copyright © 2013. All Rights Reserved.