Package org.teiid.query.sql.lang
Class SetQuery
- java.lang.Object
-
- org.teiid.query.sql.lang.Command
-
- org.teiid.query.sql.lang.QueryCommand
-
- org.teiid.query.sql.lang.SetQuery
-
- All Implemented Interfaces:
Cloneable
,LanguageObject
public class SetQuery extends QueryCommand
This object acts as a Set operator on multiple Queries - UNION, INTERSECT, and EXCEPT can be implemented with this Class
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SetQuery.Operation
-
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
-
-
Field Summary
-
Fields inherited from class org.teiid.query.sql.lang.Command
tempGroupIDs, TYPE_ALTER_PROC, TYPE_ALTER_TRIGGER, TYPE_ALTER_VIEW, TYPE_BATCHED_UPDATE, TYPE_CREATE, TYPE_DELETE, TYPE_DROP, TYPE_DYNAMIC, TYPE_EXPLAIN, TYPE_INSERT, TYPE_QUERY, TYPE_SOURCE_EVENT, TYPE_STORED_PROCEDURE, TYPE_TRIGGER_ACTION, TYPE_UNKNOWN, TYPE_UPDATE, TYPE_UPDATE_PROCEDURE
-
-
Constructor Summary
Constructors Constructor Description SetQuery(SetQuery.Operation operation)
Construct query with operation typeSetQuery(SetQuery.Operation operation, boolean all, QueryCommand leftQuery, QueryCommand rightQuery)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acceptVisitor(LanguageVisitor visitor)
Method for accepting a visitor.boolean
areResultsCachable()
Whether the results are cachable.Object
clone()
Deep clone this object to produce a new identical query.boolean
equals(Object obj)
Compare two queries for equality.QueryCommand
getLeftQuery()
SetQuery.Operation
getOperation()
Get operation for this setQuery
getProjectedQuery()
List
getProjectedSymbols()
Get the ordered list of all elements returned by this query.List<Class<?>>
getProjectedTypes()
List<QueryCommand>
getQueryCommands()
QueryCommand
getRightQuery()
int
getType()
Return type of command.static List<Expression>
getTypedProjectedSymbols(List<? extends Expression> acutal, List<Class<?>> projectedTypes, QueryMetadataInterface metadata)
int
hashCode()
Get hashcode for query.boolean
isAll()
void
setAll(boolean all)
void
setLeftQuery(QueryCommand leftQuery)
void
setOperation(SetQuery.Operation operation)
Set type of operationvoid
setProjectedTypes(List<Class<?>> projectedTypes, QueryMetadataInterface metadata)
void
setRightQuery(QueryCommand rightQuery)
-
Methods inherited from class org.teiid.query.sql.lang.QueryCommand
getLimit, getOrderBy, getWith, returnsResultSet, setLimit, setOrderBy, setWith
-
Methods inherited from class org.teiid.query.sql.lang.Command
addExternalGroupToContext, copyMetadataState, getActualCommand, getAllExternalGroups, getCacheHint, getCommandToken, getCorrelatedReferences, getExternalGroupContexts, getOption, getProcessorPlan, getResultSetColumns, getSourceHint, getTemporaryMetadata, getUpdateCommandSymbol, printCommandTree, printCommandTree, pushNewResolvingContext, sameOptionAndHint, setCacheHint, setCorrelatedReferences, setExternalGroupContexts, setOption, setProcessorPlan, setSourceHint, setTemporaryMetadata, toString
-
-
-
-
Constructor Detail
-
SetQuery
public SetQuery(SetQuery.Operation operation)
Construct query with operation type- Parameters:
operation
- Operation as specified likeSetQuery.Operation.UNION
-
SetQuery
public SetQuery(SetQuery.Operation operation, boolean all, QueryCommand leftQuery, QueryCommand rightQuery)
-
-
Method Detail
-
getProjectedQuery
public Query getProjectedQuery()
- Specified by:
getProjectedQuery
in classQueryCommand
-
getType
public int getType()
Return type of command.
-
setOperation
public void setOperation(SetQuery.Operation operation)
Set type of operation- Parameters:
operation
- Operation constant as defined in this class
-
getOperation
public SetQuery.Operation getOperation()
Get operation for this set- Returns:
- Operation as defined in this class
-
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.- Parameters:
visitor
- Visitor being used
-
getProjectedSymbols
public List getProjectedSymbols()
Get the ordered list of all elements returned by this query. These elements may be ElementSymbols or ExpressionSymbols but in all cases each represents a single column.- Specified by:
getProjectedSymbols
in classCommand
- Returns:
- Ordered list of SingleElementSymbol
-
getTypedProjectedSymbols
public static List<Expression> getTypedProjectedSymbols(List<? extends Expression> acutal, List<Class<?>> projectedTypes, QueryMetadataInterface metadata)
-
clone
public Object clone()
Deep clone this object to produce a new identical query.- Specified by:
clone
in interfaceLanguageObject
- Specified by:
clone
in classCommand
- Returns:
- Deep clone
-
equals
public boolean equals(Object obj)
Compare two queries for equality.
-
hashCode
public int hashCode()
Get hashcode for query. WARNING: This hash code relies on the hash codes of the Select and Criteria clauses. If the query changes, it's hash code will change and it can be lost from collections. Hash code is only valid after query has been completely constructed.
-
areResultsCachable
public boolean areResultsCachable()
Description copied from class:Command
Whether the results are cachable.- Specified by:
areResultsCachable
in classCommand
- Returns:
- True if the results are cachable; false otherwise.
- See Also:
Command.areResultsCachable()
-
getQueryCommands
public List<QueryCommand> getQueryCommands()
- Returns:
- the left and right queries as a list. This list cannot be modified.
-
setProjectedTypes
public void setProjectedTypes(List<Class<?>> projectedTypes, QueryMetadataInterface metadata)
-
isAll
public boolean isAll()
-
setAll
public void setAll(boolean all)
-
getLeftQuery
public QueryCommand getLeftQuery()
-
setLeftQuery
public void setLeftQuery(QueryCommand leftQuery)
-
getRightQuery
public QueryCommand getRightQuery()
-
setRightQuery
public void setRightQuery(QueryCommand rightQuery)
-
-