Package org.teiid.query.sql.lang
Class SubqueryCompareCriteria
- java.lang.Object
-
- org.teiid.query.sql.lang.Criteria
-
- org.teiid.query.sql.lang.PredicateCriteria
-
- org.teiid.query.sql.lang.AbstractCompareCriteria
-
- org.teiid.query.sql.lang.SubqueryCompareCriteria
-
- All Implemented Interfaces:
Cloneable
,PredicateCriteria.Negatable
,SubqueryContainer<QueryCommand>
,LanguageObject
,ContextReference
,Expression
public class SubqueryCompareCriteria extends AbstractCompareCriteria implements SubqueryContainer<QueryCommand>, ContextReference
This class implements a quantified comparison predicate. This is a criteria which represents a simple operator relationship between an expression and either a scalar subquery or a table subquery preceded by one of the possible quantifiers.
The quantifiers are:
SOME
andANY
, which are synonymous - the criteria is true if there is at least one comparison between the left expression and the values of the subquery. The criteria is false if the subquery returns no rows.ALL
- the criteria is true only if all of the comparisons between the left expression and each value of the subquery is true. The criteria is also true if the subquery returns no rows.
Some examples are:
- ticker = ANY (Select ... FROM ... WHERE ... )
- price >= ALL (Select ... FROM ... WHERE ... )
- revenue < (Select ... FROM ... WHERE ... )
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.teiid.query.sql.lang.PredicateCriteria
PredicateCriteria.Negatable
-
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
-
Nested classes/interfaces inherited from interface org.teiid.query.sql.lang.SubqueryContainer
SubqueryContainer.Evaluatable<T extends Command>
-
-
Constructor Summary
Constructors Constructor Description SubqueryCompareCriteria()
SubqueryCompareCriteria(Expression leftExpression, QueryCommand subCommand, int operator, int predicateQuantifier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acceptVisitor(LanguageVisitor visitor)
Method for accepting a visitor.Object
clone()
Deep copy of object.boolean
equals(Object obj)
Override equals() method.Expression
getArrayExpression()
QueryCommand
getCommand()
Returns the subquery Command objectString
getContextSymbol()
int
getPredicateQuantifier()
String
getPredicateQuantifierAsString()
Returns the predicate quantifier as a string.ExistsCriteria.SubqueryHint
getSubqueryHint()
int
hashCode()
Get hash code.void
negate()
void
setArrayExpression(Expression expression)
void
setCommand(QueryCommand command)
Set the subquery command (either a SELECT or a procedure execution).void
setPredicateQuantifier(int predicateQuantifier)
void
setSubqueryHint(ExistsCriteria.SubqueryHint subqueryHint)
-
Methods inherited from class org.teiid.query.sql.lang.AbstractCompareCriteria
getInverseOperator, getLeftExpression, getOperator, getOperator, getOperatorAsString, setLeftExpression, setOperator
-
Methods inherited from class org.teiid.query.sql.lang.Criteria
applyDemorgan, combineCriteria, combineCriteria, combineCriteria, getType, separateCriteriaByAnd, toString
-
-
-
-
Field Detail
-
SOME
public static final int SOME
"Some" predicate quantifier (equivalent to "Any")- See Also:
- Constant Field Values
-
ANY
public static final int ANY
"Any" predicate quantifier (equivalent to "Some")- See Also:
- Constant Field Values
-
ALL
public static final int ALL
"All" predicate quantifier- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SubqueryCompareCriteria
public SubqueryCompareCriteria()
-
SubqueryCompareCriteria
public SubqueryCompareCriteria(Expression leftExpression, QueryCommand subCommand, int operator, int predicateQuantifier)
-
-
Method Detail
-
getContextSymbol
public String getContextSymbol()
- Specified by:
getContextSymbol
in interfaceContextReference
-
getPredicateQuantifier
public int getPredicateQuantifier()
- Returns:
- the predicate quantifier
-
setPredicateQuantifier
public void setPredicateQuantifier(int predicateQuantifier)
- Parameters:
predicateQuantifier
- the predicate quantifier
-
getCommand
public QueryCommand getCommand()
Description copied from interface:SubqueryContainer
Returns the subquery Command object- Specified by:
getCommand
in interfaceSubqueryContainer<QueryCommand>
- Returns:
- the subquery Command object
-
setCommand
public void setCommand(QueryCommand command)
Set the subquery command (either a SELECT or a procedure execution).- Specified by:
setCommand
in interfaceSubqueryContainer<QueryCommand>
- Parameters:
command
- Command to execute to get the values for the criteria
-
getPredicateQuantifierAsString
public String getPredicateQuantifierAsString()
Returns the predicate quantifier as a string.- Returns:
- String version of predicate quantifier
-
acceptVisitor
public void acceptVisitor(LanguageVisitor visitor)
Description copied from interface:LanguageObject
Method for accepting a visitor. It is the responsibility of the language object to call back on the visitor.- Specified by:
acceptVisitor
in interfaceLanguageObject
- Parameters:
visitor
- Visitor being used
-
hashCode
public int hashCode()
Get hash code. WARNING: The hash code is based on data in the criteria. If data values are changed, the hash code will change - don't hash this object and change values.
-
equals
public boolean equals(Object obj)
Override equals() method.
-
clone
public Object clone()
Deep copy of object. The values Iterator of this object will not be cloned - it will be null in the new object (see #setValueIterator setValueIterator}).- Specified by:
clone
in interfaceLanguageObject
- Specified by:
clone
in classPredicateCriteria
- Returns:
- Deep copy of object
- See Also:
Object.clone()
-
negate
public void negate()
- Specified by:
negate
in interfacePredicateCriteria.Negatable
- Overrides:
negate
in classAbstractCompareCriteria
-
getSubqueryHint
public ExistsCriteria.SubqueryHint getSubqueryHint()
-
setSubqueryHint
public void setSubqueryHint(ExistsCriteria.SubqueryHint subqueryHint)
-
getArrayExpression
public Expression getArrayExpression()
-
setArrayExpression
public void setArrayExpression(Expression expression)
-
-