public class ResolverUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ResolverUtil.ResolvedLookup |
Modifier and Type | Method and Description |
---|---|
static TempMetadataID |
addTempGroup(TempMetadataAdapter metadata,
GroupSymbol symbol,
List<? extends Expression> symbols,
boolean tempTable) |
static TempMetadataID |
addTempTable(TempMetadataAdapter metadata,
GroupSymbol symbol,
List<? extends Expression> symbols) |
static boolean |
canImplicitlyConvert(String fromType,
String toType)
Gets whether there exists an implicit conversion from the source type to
the target type
|
static void |
clearGroupInfo(GroupSymbol group,
QueryMetadataInterface metadata) |
static Constant |
convertConstant(String sourceTypeName,
String targetTypeName,
Constant constant) |
static Expression |
convertExpression(Expression sourceExpression,
String targetTypeName,
QueryMetadataInterface metadata)
Replaces a sourceExpression with a conversion of the source expression
to the target type.
|
static Expression |
convertExpression(Expression sourceExpression,
String sourceTypeName,
String targetTypeName,
QueryMetadataInterface metadata)
Replaces a sourceExpression with a conversion of the source expression
to the target type.
|
static void |
findKeyPreserved(FromClause clause,
Set<GroupSymbol> keyPreservingGroups,
QueryMetadataInterface metadata) |
static void |
findKeyPreserved(Query query,
Set<GroupSymbol> keyPreservingGroups,
QueryMetadataInterface metadata) |
static List<GroupSymbol> |
findMatchingGroups(String groupContext,
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 List |
getAccessPatternElementsInGroups(QueryMetadataInterface metadata,
Collection groups,
boolean flatten)
When access patterns are flattened, they are an approximation the user
may need to enter as criteria.
|
static String |
getCommonRuntimeType(String[] typeNames)
Gets the most specific type to which all the given types have an implicit
conversion.
|
static Function |
getConversion(Expression sourceExpression,
String sourceTypeName,
String targetTypeName,
boolean implicit,
FunctionLibrary library)
IMPORTANT: source and target must be basic runtime types
|
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 |
hasDefault(Object mid,
QueryMetadataInterface metadata) |
static boolean |
nameMatchesGroup(String groupContext,
String fullName) |
static 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,
List symbols) |
static void |
resolveLimit(Limit limit) |
static ResolverUtil.ResolvedLookup |
resolveLookup(Function lookup,
QueryMetadataInterface metadata) |
static void |
resolveNullLiterals(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,
TempMetadataAdapter metadata)
Attempt to resolve the order by throws QueryResolverException if the
symbol is not of SingleElementSymbol type
|
static void |
setDesiredType(Expression expression,
Class<?> targetType,
LanguageObject surroundingExpression)
Utility to set the type of an expression if it is a Reference and has a null type.
|
static void |
setDesiredType(List<DerivedColumn> passing,
LanguageObject obj) |
static void |
setDesiredType(List<DerivedColumn> passing,
LanguageObject obj,
Class<?> type) |
static void |
setTypeIfNull(Expression symbol,
Class<?> replacement) |
public static String getCommonRuntimeType(String[] typeNames)
typeNames
- an ordered array of unique type names.public static boolean canImplicitlyConvert(String fromType, String toType)
fromType
- toType
- fromType
to the toType
.public static Expression convertExpression(Expression sourceExpression, String targetTypeName, QueryMetadataInterface metadata) throws QueryResolverException
sourceExpression
- targetTypeName
- QueryResolverException
public static Expression convertExpression(Expression sourceExpression, String sourceTypeName, String targetTypeName, QueryMetadataInterface metadata) throws QueryResolverException
sourceExpression
- sourceTypeName
- targetTypeName
- QueryResolverException
public static Constant convertConstant(String sourceTypeName, String targetTypeName, Constant constant)
public static Function getConversion(Expression sourceExpression, String sourceTypeName, String targetTypeName, boolean implicit, FunctionLibrary library)
sourceExpression
- sourceTypeName
- targetTypeName
- implicit
- library
- public static void setDesiredType(List<DerivedColumn> passing, LanguageObject obj) throws QueryResolverException
QueryResolverException
public static void setDesiredType(List<DerivedColumn> passing, LanguageObject obj, Class<?> type) throws QueryResolverException
QueryResolverException
public static void setDesiredType(Expression expression, 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, TempMetadataAdapter 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
- QueryMetadataInterfaceQueryResolverException
QueryMetadataException
TeiidComponentException
public static Expression getDefault(ElementSymbol symbol, QueryMetadataInterface metadata) throws TeiidComponentException, QueryMetadataException, QueryResolverException
symbol
- ElementSymbol retrieved from metadata, fully-resolvedmetadata
- QueryMetadataInterfaceQueryResolverException
- if expr is null, parameter is required and no
default value is definedQueryMetadataException
- for error retrieving metadataTeiidComponentException
QueryParserException
public static boolean hasDefault(Object mid, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException
public static List<ElementSymbol> resolveElementsInGroup(GroupSymbol group, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException
public static void clearGroupInfo(GroupSymbol group, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException
public static List getAccessPatternElementsInGroups(QueryMetadataInterface metadata, 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, List symbols) throws TeiidComponentException, QueryResolverException
public static TempMetadataID addTempGroup(TempMetadataAdapter metadata, GroupSymbol symbol, List<? extends Expression> symbols, boolean tempTable) throws QueryResolverException
QueryResolverException
public static TempMetadataID addTempTable(TempMetadataAdapter metadata, GroupSymbol symbol, List<? extends Expression> symbols) throws QueryResolverException
QueryResolverException
public static void resolveNullLiterals(List symbols)
select
- The select clausepublic static void setTypeIfNull(Expression symbol, Class<?> replacement)
public static List<GroupSymbol> findMatchingGroups(String groupContext, Collection<GroupSymbol> groups, QueryMetadataInterface metadata) throws TeiidComponentException, QueryMetadataException
groupContext
- groups
- metadata
- TeiidComponentException
QueryMetadataException
public static ResolverUtil.ResolvedLookup resolveLookup(Function lookup, QueryMetadataInterface metadata) throws QueryResolverException, TeiidComponentException
public static void resolveGroup(GroupSymbol symbol, QueryMetadataInterface metadata) throws TeiidComponentException, QueryResolverException
public static void findKeyPreserved(Query query, Set<GroupSymbol> keyPreservingGroups, QueryMetadataInterface metadata) throws TeiidComponentException, QueryMetadataException
public static void findKeyPreserved(FromClause clause, Set<GroupSymbol> keyPreservingGroups, QueryMetadataInterface metadata) throws TeiidComponentException, QueryMetadataException
public static void fullyQualifyElements(Command command)
command
- Command to convertCopyright © 2018 JBoss by Red Hat. All rights reserved.