Package org.teiid.query.resolver
Class QueryResolver
- java.lang.Object
-
- org.teiid.query.resolver.QueryResolver
-
public class QueryResolver extends Object
The QueryResolver is used between Parsing and QueryValidation. The SQL queries, inserts, updates and deletes are parsed and converted into objects. The language objects have variable names which resolved to fully qualified names using metadata information. The resolver is also used in transforming the values in language objects to their variable types defined in metadata.
-
-
Constructor Summary
Constructors Constructor Description QueryResolver()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Command
expandCommand(ProcedureContainer proc, QueryMetadataInterface metadata, AnalysisRecord analysisRecord)
static Map<ElementSymbol,Expression>
getVariableValues(Command command, boolean changingOnly, QueryMetadataInterface metadata)
static boolean
isView(GroupSymbol virtualGroup, QueryMetadataInterface qmi)
static TempMetadataStore
resolveCommand(Command command, QueryMetadataInterface metadata)
This implements an algorithm to resolve all the symbols created by the parser into real metadata IDsstatic TempMetadataStore
resolveCommand(Command currentCommand, QueryMetadataInterface metadata, boolean resolveNullLiterals)
static TempMetadataStore
resolveCommand(Command currentCommand, GroupSymbol container, int type, QueryMetadataInterface metadata, boolean inferProcedureResultSetColumns)
Resolve a command in a given type container and type context.static void
resolveCriteria(Criteria criteria, QueryMetadataInterface metadata)
Resolve just a criteria.static void
resolveSubqueries(Command command, TempMetadataAdapter metadata, Collection<GroupSymbol> externalGroups)
static QueryNode
resolveView(GroupSymbol virtualGroup, QueryNode qnode, String cacheString, QueryMetadataInterface qmi, boolean logValidation)
static void
setChildMetadata(Command subCommand, TempMetadataStore parentTempMetadata, GroupContext parentContext)
static void
setChildMetadata(Command subCommand, Command parent)
static void
validateProjectedSymbols(GroupSymbol virtualGroup, List<? extends Expression> symbols, List<? extends Expression> projectedSymbols)
static void
validateProjectedSymbols(GroupSymbol virtualGroup, QueryMetadataInterface qmi, Command result)
-
-
-
Method Detail
-
expandCommand
public static Command expandCommand(ProcedureContainer proc, QueryMetadataInterface metadata, AnalysisRecord analysisRecord) throws QueryResolverException, QueryMetadataException, TeiidComponentException
-
resolveCommand
public static TempMetadataStore resolveCommand(Command command, QueryMetadataInterface metadata) throws QueryResolverException, TeiidComponentException
This implements an algorithm to resolve all the symbols created by the parser into real metadata IDs- Parameters:
command
- Command the SQL command we are running (Select, Update, Insert, Delete)metadata
- QueryMetadataInterface the metadata- Returns:
- Throws:
QueryResolverException
TeiidComponentException
-
resolveCommand
public static TempMetadataStore resolveCommand(Command currentCommand, GroupSymbol container, int type, QueryMetadataInterface metadata, boolean inferProcedureResultSetColumns) throws QueryResolverException, TeiidComponentException
Resolve a command in a given type container and type context.- Parameters:
type
- TheCommand
typeinferProcedureResultSetColumns
- if true and the currentCommand is a procedure definition, then resolving will set the getResultSetColumns on the command to what is discoverable in the procedure body.- Throws:
QueryResolverException
TeiidComponentException
-
resolveCommand
public static TempMetadataStore resolveCommand(Command currentCommand, QueryMetadataInterface metadata, boolean resolveNullLiterals) throws QueryResolverException, TeiidComponentException
-
resolveCriteria
public static void resolveCriteria(Criteria criteria, QueryMetadataInterface metadata) throws QueryResolverException, QueryMetadataException, TeiidComponentException
Resolve just a criteria. The criteria will be modified so nothing is returned.- Parameters:
criteria
- Criteria to resolvemetadata
- Metadata implementation- Throws:
QueryResolverException
QueryMetadataException
TeiidComponentException
-
setChildMetadata
public static void setChildMetadata(Command subCommand, TempMetadataStore parentTempMetadata, GroupContext parentContext)
-
getVariableValues
public static Map<ElementSymbol,Expression> getVariableValues(Command command, boolean changingOnly, QueryMetadataInterface metadata) throws QueryMetadataException, QueryResolverException, TeiidComponentException
-
resolveSubqueries
public static void resolveSubqueries(Command command, TempMetadataAdapter metadata, Collection<GroupSymbol> externalGroups) throws QueryResolverException, TeiidComponentException
-
resolveView
public static QueryNode resolveView(GroupSymbol virtualGroup, QueryNode qnode, String cacheString, QueryMetadataInterface qmi, boolean logValidation) throws TeiidComponentException, QueryMetadataException, QueryResolverException, QueryValidatorException
-
validateProjectedSymbols
public static void validateProjectedSymbols(GroupSymbol virtualGroup, QueryMetadataInterface qmi, Command result) throws QueryMetadataException, TeiidComponentException, QueryValidatorException
-
validateProjectedSymbols
public static void validateProjectedSymbols(GroupSymbol virtualGroup, List<? extends Expression> symbols, List<? extends Expression> projectedSymbols) throws QueryValidatorException
- Throws:
QueryValidatorException
-
isView
public static boolean isView(GroupSymbol virtualGroup, QueryMetadataInterface qmi) throws TeiidComponentException, QueryMetadataException
-
-