|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.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 symbols,
boolean tempTable)
|
static void |
addTempTable(TempMetadataAdapter metadata,
GroupSymbol symbol,
java.util.List 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)
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)
Replaces a sourceExpression with a conversion of the source expression to the target type. |
static java.util.List |
findMatchingGroups(java.lang.String groupContext,
java.util.Collection groups,
QueryMetadataInterface metadata)
|
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 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 |
orderByContainsVariable(OrderBy orderBy,
SingleElementSymbol ses,
int position)
Checks if a variable is in the ORDER BY |
static java.util.List |
resolveElements(GroupSymbol group,
QueryMetadataInterface metadata,
java.util.List elementIDs)
|
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,
java.util.List fromClauseGroups,
java.util.List knownElements,
QueryMetadataInterface metadata,
boolean isSimpleQuery)
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. |
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) throws QueryResolverException
sourceExpression
- targetTypeName
-
QueryResolverException
public static Expression convertExpression(Expression sourceExpression, java.lang.String sourceTypeName, java.lang.String targetTypeName) throws QueryResolverException
sourceExpression
- sourceTypeName
- targetTypeName
-
QueryResolverException
public static Constant convertConstant(java.lang.String sourceTypeName, java.lang.String targetTypeName, Constant constant)
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, java.util.List fromClauseGroups, java.util.List knownElements, QueryMetadataInterface metadata, boolean isSimpleQuery) throws QueryResolverException, QueryMetadataException, MetaMatrixComponentException
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
- QueryMetadataInterfaceisSimpleQuery
-
QueryResolverException
QueryMetadataException
MetaMatrixComponentException
public static Expression getDefault(ElementSymbol symbol, QueryMetadataInterface metadata) throws MetaMatrixComponentException, 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
MetaMatrixComponentException
public static java.util.List<ElementSymbol> resolveElementsInGroup(GroupSymbol group, QueryMetadataInterface metadata) throws QueryMetadataException, MetaMatrixComponentException
QueryMetadataException
MetaMatrixComponentException
public static java.util.List resolveElements(GroupSymbol group, QueryMetadataInterface metadata, java.util.List elementIDs) throws MetaMatrixComponentException, QueryMetadataException
MetaMatrixComponentException
QueryMetadataException
public static java.util.List getAccessPatternElementsInGroups(QueryMetadataInterface metadata, java.util.Collection groups, boolean flatten) throws MetaMatrixComponentException, QueryMetadataException
metadata
- groups
- flatten
-
MetaMatrixComponentException
QueryMetadataException
public static void resolveLimit(Limit limit) throws QueryResolverException
QueryResolverException
public static void resolveImplicitTempGroup(TempMetadataAdapter metadata, GroupSymbol symbol, java.util.List symbols) throws MetaMatrixComponentException, QueryResolverException
MetaMatrixComponentException
QueryResolverException
public static TempMetadataID addTempGroup(TempMetadataAdapter metadata, GroupSymbol symbol, java.util.List symbols, boolean tempTable) throws QueryResolverException
QueryResolverException
public static void addTempTable(TempMetadataAdapter metadata, GroupSymbol symbol, java.util.List symbols) throws QueryResolverException
QueryResolverException
public static void resolveNullLiterals(java.util.List symbols)
select
- The select clausepublic static java.util.List findMatchingGroups(java.lang.String groupContext, java.util.Collection groups, QueryMetadataInterface metadata) throws MetaMatrixComponentException, QueryMetadataException
groupContext
- groups
- metadata
-
MetaMatrixComponentException
QueryMetadataException
public static boolean orderByContainsVariable(OrderBy orderBy, SingleElementSymbol ses, int position)
position
- 0-based index of the variable
public static ResolverUtil.ResolvedLookup resolveLookup(Function lookup, QueryMetadataInterface metadata) throws QueryResolverException, MetaMatrixComponentException
QueryResolverException
MetaMatrixComponentException
public static void resolveGroup(GroupSymbol symbol, QueryMetadataInterface metadata) throws MetaMatrixComponentException, QueryResolverException
MetaMatrixComponentException
QueryResolverException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |