Package org.teiid.query.sql.symbol
Class GroupSymbol
- java.lang.Object
-
- org.teiid.query.sql.symbol.Symbol
-
- org.teiid.query.sql.symbol.GroupSymbol
-
- All Implemented Interfaces:
Cloneable
,Comparable<GroupSymbol>
,LanguageObject
public class GroupSymbol extends Symbol implements Comparable<GroupSymbol>
This is the server's representation of a metadata group symbol. The group symbol has a name, an optional definition, and a reference to a real metadata ID. Typically, a GroupSymbol will be created only from a name and possibly a definition if the group has an alias. The metadata ID is discovered only when resolving the query.
For example, if the original string contained a FROM clause such as "FROM Group1 AS G, Group2", there would be two GroupSymbols created. The first would have name=G, definition=Group1 and the second would have name=Group2, definition=null.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
-
-
Field Summary
Fields Modifier and Type Field Description static String
TEMP_GROUP_PREFIX
-
Fields inherited from class org.teiid.query.sql.symbol.Symbol
outputName, SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description GroupSymbol(String name)
Construct a symbol with a name.GroupSymbol(String name, String definition)
Construct a symbol with a name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acceptVisitor(LanguageVisitor visitor)
Method for accepting a visitor.GroupSymbol
clone()
Return a deep copy of this object.int
compareTo(GroupSymbol o)
Compare two groups and give an ordering.boolean
equals(Object obj)
Compare group symbolsObject
getCheckMatViewStatus()
String
getDefinition()
Get the definition for the group symbol, which may be nullObject
getMetadataID()
Get the metadata ID that this group symbol resolves to.Object
getModelMetadataId()
String
getName()
Get the name of the symbolString
getNonCorrelationName()
String
getOutputDefinition()
boolean
hasAlias()
int
hashCode()
Return a hash code for this symbol.boolean
isGlobalTable()
boolean
isImplicitTempGroupSymbol()
boolean
isProcedure()
boolean
isPushedCommonTable()
Returns if this is a pushed Common Table Set after resolving and initial common table planningboolean
isResolved()
Returns true if this symbol has been completely resolved with respect to actual runtime metadata.static boolean
isTempGroupName(String name)
boolean
isTempGroupSymbol()
Returns true if this is a symbol for a temporary (implicit or explicit) group May return false for explicit temp tables prior to resolving.boolean
isTempTable()
Returns if this is a Temp Table Set after resolving.void
setCheckMatStatus(Object viewMatadataId)
void
setDefinition(String definition)
Set the definition for the group symbol, which may be nullvoid
setGlobalTable(boolean isGlobalTable)
void
setIsTempTable(boolean isTempTable)
void
setMetadataID(Object metadataID)
Set the metadata ID that this group symbol resolves to.void
setName(String name)
void
setOutputDefinition(String outputDefinition)
void
setProcedure(boolean isProcedure)
-
Methods inherited from class org.teiid.query.sql.symbol.Symbol
getName, getOutputName, getOutputName, getShortName, getShortName, getShortName, setOutputName, setShortName, toString
-
-
-
-
Field Detail
-
TEMP_GROUP_PREFIX
public static final String TEMP_GROUP_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GroupSymbol
public GroupSymbol(String name)
Construct a symbol with a name.- Parameters:
name
- Name of the symbol- Throws:
IllegalArgumentException
- If name is null
-
GroupSymbol
public GroupSymbol(String name, String definition)
Construct a symbol with a name.- Parameters:
name
- Name of the symboldefinition
- Definition of the symbol, may be null- Throws:
IllegalArgumentException
- If name is null
-
-
Method Detail
-
getModelMetadataId
public Object getModelMetadataId()
-
getNonCorrelationName
public String getNonCorrelationName()
-
getDefinition
public String getDefinition()
Get the definition for the group symbol, which may be null- Returns:
- Group definition, may be null
-
setDefinition
public void setDefinition(String definition)
Set the definition for the group symbol, which may be null- Parameters:
definition
- Definition
-
getMetadataID
public Object getMetadataID()
Get the metadata ID that this group symbol resolves to. If the group symbol has not been resolved yet, this will be null. If the symbol has been resolved, this will never be null.- Returns:
- Metadata ID object
-
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
-
setMetadataID
public void setMetadataID(Object metadataID)
Set the metadata ID that this group symbol resolves to. It cannot be null.- Parameters:
metadataID
- Metadata ID object- Throws:
IllegalArgumentException
- If metadataID is null
-
isResolved
public boolean isResolved()
Returns true if this symbol has been completely resolved with respect to actual runtime metadata. A resolved symbol has been validated that it refers to actual metadata and will have references to the real metadata IDs if necessary. Different types of symbols determine their resolution in different ways, so this method is abstract and must be implemented by subclasses.- Returns:
- True if resolved with runtime metadata
-
isTempGroupSymbol
public boolean isTempGroupSymbol()
Returns true if this is a symbol for a temporary (implicit or explicit) group May return false for explicit temp tables prior to resolving. seeisTempTable()
- Returns:
- Since:
- 5.5
-
isImplicitTempGroupSymbol
public boolean isImplicitTempGroupSymbol()
-
compareTo
public int compareTo(GroupSymbol o)
Compare two groups and give an ordering.- Specified by:
compareTo
in interfaceComparable<GroupSymbol>
- Parameters:
o
- Other group- Returns:
- -1, 0, or 1 depending on how this compares to group
-
clone
public GroupSymbol clone()
Return a deep copy of this object.- Specified by:
clone
in interfaceLanguageObject
- Specified by:
clone
in classSymbol
- Returns:
- Deep copy of the object
-
equals
public boolean equals(Object obj)
Compare group symbols
-
hasAlias
public boolean hasAlias()
-
setIsTempTable
public void setIsTempTable(boolean isTempTable)
-
isTempGroupName
public static boolean isTempGroupName(String name)
-
isTempTable
public boolean isTempTable()
Returns if this is a Temp Table Set after resolving.- Returns:
-
isPushedCommonTable
public boolean isPushedCommonTable()
Returns if this is a pushed Common Table Set after resolving and initial common table planning- Returns:
-
isProcedure
public boolean isProcedure()
-
setProcedure
public void setProcedure(boolean isProcedure)
-
getOutputDefinition
public String getOutputDefinition()
-
setOutputDefinition
public void setOutputDefinition(String outputDefinition)
-
isGlobalTable
public boolean isGlobalTable()
-
setGlobalTable
public void setGlobalTable(boolean isGlobalTable)
-
hashCode
public int hashCode()
Description copied from class:Symbol
Return a hash code for this symbol.
-
setCheckMatStatus
public void setCheckMatStatus(Object viewMatadataId)
-
getCheckMatViewStatus
public Object getCheckMatViewStatus()
-
-