|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.teiid.query.resolver.util.ResolverUtil
public class ResolverUtil
Utilities used during resolution
Nested Class Summary | |
---|---|
static class |
ResolverUtil.ResolvedLookup
|
Method Summary | |
---|---|
static TempMetadataID |
addTempGroup(TempMetadataAdapter metadata,
GroupSymbol symbol,
java.util.List<? extends SingleElementSymbol> symbols,
boolean tempTable)
|
static TempMetadataID |
addTempTable(TempMetadataAdapter metadata,
GroupSymbol symbol,
java.util.List<? extends SingleElementSymbol> symbols)
|
static boolean |
canImplicitlyConvert(java.lang.String fromType,
java.lang.String toType)
Gets whether there exists an implicit conversion from the source type to the target type |
static Constant |
convertConstant(java.lang.String sourceTypeName,
java.lang.String targetTypeName,
Constant constant)
|
static Expression |
convertExpression(Expression sourceExpression,
java.lang.String targetTypeName,
QueryMetadataInterface metadata)
Replaces a sourceExpression with a conversion of the source expression to the target type. |
static Expression |
convertExpression(Expression sourceExpression,
java.lang.String sourceTypeName,
java.lang.String targetTypeName,
QueryMetadataInterface metadata)
Replaces a sourceExpression with a conversion of the source expression to the target type. |
static void |
findKeyPreserved(FromClause clause,
java.util.Set<GroupSymbol> keyPreservingGroups,
QueryMetadataInterface metadata)
|
static void |
findKeyPreserved(Query query,
java.util.Set<GroupSymbol> keyPreservingGroups,
QueryMetadataInterface metadata)
|
static java.util.List<GroupSymbol> |
findMatchingGroups(java.lang.String groupContext,
java.util.Collection<GroupSymbol> groups,
QueryMetadataInterface metadata)
|
static void |
fullyQualifyElements(Command command)
This method will convert all elements in a command to their fully qualified name. |
static java.util.List |
getAccessPatternElementsInGroups(QueryMetadataInterface metadata,
java.util.Collection groups,
boolean flatten)
When access patterns are flattened, they are an approximation the user may need to enter as criteria. |
static java.lang.String |
getCommonType(java.lang.String[] typeNames)
Gets the most specific type to which all the given types have an implicit conversion. |
static Function |
getConversion(Expression sourceExpression,
java.lang.String sourceTypeName,
java.lang.String targetTypeName,
boolean implicit,
FunctionLibrary library)
|
static Expression |
getDefault(ElementSymbol symbol,
QueryMetadataInterface metadata)
Get the default value for the parameter, which could be null if the parameter is set to NULLABLE. |
static boolean |
nameMatchesGroup(java.lang.String groupContext,
java.lang.String fullName)
|
static java.util.List<ElementSymbol> |
resolveElementsInGroup(GroupSymbol group,
QueryMetadataInterface metadata)
Returns the resolved elements in the given group. |
static void |
resolveGroup(GroupSymbol symbol,
QueryMetadataInterface metadata)
|
static void |
resolveImplicitTempGroup(TempMetadataAdapter metadata,
GroupSymbol symbol,
java.util.List symbols)
|
static void |
resolveLimit(Limit limit)
|
static ResolverUtil.ResolvedLookup |
resolveLookup(Function lookup,
QueryMetadataInterface metadata)
|
static void |
resolveNullLiterals(java.util.List symbols)
Look for a null literal in the SELECT clause and set it's type to STRING. |
static void |
resolveOrderBy(OrderBy orderBy,
QueryCommand command,
QueryMetadataInterface metadata)
Attempt to resolve the order by throws QueryResolverException if the symbol is not of SingleElementSymbol type |
static void |
setDesiredType(Expression expression,
java.lang.Class<?> targetType,
LanguageObject surroundingExpression)
Utility to set the type of an expression if it is a Reference and has a null type. |
static void |
setTypeIfNull(SingleElementSymbol symbol,
java.lang.Class<?> replacement)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.String getCommonType(java.lang.String[] typeNames)
typeNames
- an ordered array of unique type names.
public static boolean canImplicitlyConvert(java.lang.String fromType, java.lang.String toType)
fromType
- toType
-
fromType
to the toType
.public static Expression convertExpression(Expression sourceExpression, java.lang.String targetTypeName, QueryMetadataInterface metadata) throws QueryResolverException
sourceExpression
- targetTypeName
-
QueryResolverException
public static Expression convertExpression(Expression sourceExpression, java.lang.String sourceTypeName, java.lang.String targetTypeName, QueryMetadataInterface metadata) throws QueryResolverException
sourceExpression
- sourceTypeName
- targetTypeName
-
QueryResolverException
public static Constant convertConstant(java.lang.String sourceTypeName, java.lang.String targetTypeName, Constant constant)
public static Function getConversion(Expression sourceExpression, java.lang.String sourceTypeName, java.lang.String targetTypeName, boolean implicit, FunctionLibrary library)
public static void setDesiredType(Expression expression, java.lang.Class<?> targetType, LanguageObject surroundingExpression) throws QueryResolverException
expression
- the expression to testtargetType
- the target type, if the expression's type is null.
QueryResolverException
- if unable to set the reference type to the target type.public static void resolveOrderBy(OrderBy orderBy, QueryCommand command, QueryMetadataInterface metadata) throws QueryResolverException, QueryMetadataException, TeiidComponentException
orderBy
- fromClauseGroups
- groups of the FROM clause of the query (for resolving
ambiguous unqualified element names), or empty List if a Set
Query Order By is being resolvedknownElements
- resolved elements from SELECT clause, which are only ones
allowed to be in ORDER BYmetadata
- QueryMetadataInterface
QueryResolverException
QueryMetadataException
TeiidComponentException
public static Expression getDefault(ElementSymbol symbol, QueryMetadataInterface metadata) throws TeiidComponentException, QueryMetadataException, QueryResolverException
symbol
- ElementSymbol retrieved from metadata, fully-resolvedmetadata
- QueryMetadataInterface
QueryResolverException
- if expr is null, parameter is required and no
default value is defined
QueryMetadataException
- for error retrieving metadata
TeiidComponentException
public static java.util.List<ElementSymbol> resolveElementsInGroup(GroupSymbol group, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException
QueryMetadataException
TeiidComponentException
public static java.util.List getAccessPatternElementsInGroups(QueryMetadataInterface metadata, java.util.Collection groups, boolean flatten) throws TeiidComponentException, QueryMetadataException
metadata
- groups
- flatten
-
TeiidComponentException
QueryMetadataException
public static void resolveLimit(Limit limit) throws QueryResolverException
QueryResolverException
public static void resolveImplicitTempGroup(TempMetadataAdapter metadata, GroupSymbol symbol, java.util.List symbols) throws TeiidComponentException, QueryResolverException
TeiidComponentException
QueryResolverException
public static TempMetadataID addTempGroup(TempMetadataAdapter metadata, GroupSymbol symbol, java.util.List<? extends SingleElementSymbol> symbols, boolean tempTable) throws QueryResolverException
QueryResolverException
public static TempMetadataID addTempTable(TempMetadataAdapter metadata, GroupSymbol symbol, java.util.List<? extends SingleElementSymbol> symbols) throws QueryResolverException
QueryResolverException
public static void resolveNullLiterals(java.util.List symbols)
select
- The select clausepublic static void setTypeIfNull(SingleElementSymbol symbol, java.lang.Class<?> replacement)
public static java.util.List<GroupSymbol> findMatchingGroups(java.lang.String groupContext, java.util.Collection<GroupSymbol> groups, QueryMetadataInterface metadata) throws TeiidComponentException, QueryMetadataException
groupContext
- groups
- metadata
-
TeiidComponentException
QueryMetadataException
public static boolean nameMatchesGroup(java.lang.String groupContext, java.lang.String fullName)
public static ResolverUtil.ResolvedLookup resolveLookup(Function lookup, QueryMetadataInterface metadata) throws QueryResolverException, TeiidComponentException
QueryResolverException
TeiidComponentException
public static void resolveGroup(GroupSymbol symbol, QueryMetadataInterface metadata) throws TeiidComponentException, QueryResolverException
TeiidComponentException
QueryResolverException
public static void findKeyPreserved(Query query, java.util.Set<GroupSymbol> keyPreservingGroups, QueryMetadataInterface metadata) throws TeiidComponentException, QueryMetadataException
TeiidComponentException
QueryMetadataException
public static void findKeyPreserved(FromClause clause, java.util.Set<GroupSymbol> keyPreservingGroups, QueryMetadataInterface metadata) throws TeiidComponentException, QueryMetadataException
TeiidComponentException
QueryMetadataException
public static void fullyQualifyElements(Command command)
command
- Command to convert
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |