public class SqlQuery extends QueryClause implements SqlStatement, ITableFunctionParameter
AbstractSyntaxTree.LogCounter| Modifier and Type | Method and Description |
|---|---|
SqlQuery |
addJoin(MapPhysicalNode physicalNode,
JoinTable.JoinType joinType,
SqlQuery joinQuery,
ArrayExpression[] joinConditionHolder,
boolean addJoinCondition,
boolean orderedJoin,
SqlQuery.SelectMapContainer selectMapContainer,
IMapComponent leftComponent,
IMapComponent rightComponent,
MapConnectorPoint leftPoint,
MapConnectorPoint rightPoint,
boolean inDataset,
java.util.Set existingAliasSet,
boolean optimizeLeftInlineViews,
boolean isCombinedQuery)
Add a query to be joined to this query.
|
java.util.List |
getAliasList()
Get the list of aliases of the select items of this query.
|
java.util.List |
getChildren()
Get the list of child objects owned by this substitution API object.
|
java.lang.String |
getColumnAliasSeparator()
Gets the separator between column expression and alias, based on the source technology of this query.
|
java.lang.String |
getConstantFromClauseText()
Get the FROM clause text for a query with only constant select item expressions, and no
real source.
|
java.lang.String |
getConstantFromClauseText(boolean includeFromKeyword)
Get the FROM clause text for a query with only constant select item expressions, and no
real source.
|
IColumn |
getExpressionColumn(Expression expr)
Get the source column referenced by the expression of an select item.
|
java.util.List |
getExpressions()
Get a list of expressions owned by this substitution API object.
|
java.util.List |
getFromList()
Get the From clause list of the query.
|
java.util.List |
getGroupByList()
Get the GROUP BY expressions of this query.
|
java.util.List |
getHavingList()
Get the HAVING expressions of this query.
|
SqlQuery |
getInputQuery(int index)
Get the input queries that are used in a set query (e.g.
|
int |
getInputQueryCount() |
MapPhysicalNode |
getJournalizedSource()
Get the journalized source node for this query.
|
java.util.List |
getLateralViewList()
Gets the flattened complex columns that would result in a Hive lateral view, basically only those complex columns that comprise a collection.
|
java.util.List |
getNonOrderedComponents()
Get the list of components participating in the non-ANSI join of this query.
|
java.util.List |
getOrderByList()
Get the ORDER BY expressions of this query.
|
IMapComponent |
getQuerySourceComponent()
Get the source mapping component that acts as the main source for this query.
|
java.util.List |
getSelectHints()
Get the select hints associated with this query.
|
java.util.List |
getSelectList()
Get the list of select items of this query.
|
SqlQuery |
getSetOperand()
Gets the query that is linked with this query through a set operation.
|
java.lang.String |
getSetOperation()
Gets the set operation linking this query with another query.
|
java.util.List |
getSourceColumns()
Get the source columns referenced by the select items of this query.
|
ILocation |
getSourceLocation()
Get source location information for this AST, if any is defined, else return null.
|
TableReference |
getSourceTable(java.lang.String baseName)
Get the source table of this query
|
java.util.Collection |
getSourceTables()
Get all source tables involved in this query.
|
java.util.List |
getSourceTables(boolean includeSubqueries)
Get all source tables, including those referenced in subqueries.
|
java.util.List |
getSubqueries() |
java.util.Map |
getTemplateSubstitutionMap()
Get a hash map containing built-in template substitution variable names as the hash key,
and the substitution variable value as values.
|
java.lang.String |
getText()
Get the expanded text of this query object which represents a SELECT statement.
|
java.lang.String |
getType()
Get a class type string for this substitution API object.
|
java.util.List |
getWhereList()
Get the where clause of the query.
|
boolean |
hasAggregation()
Returns true if this query has aggregation, otherwise false.
|
boolean |
hasFilterWithAggregation() |
boolean |
hasJournalizedSource() |
boolean |
hasNonOrderedJoin()
Check if this query is participating in an non-ANSI join.
|
boolean |
hasSourceReference()
Checks whether the select items of this query references a source object
|
boolean |
hasWindowFunction()
Returns true if this query has a window or analytical function, otherwise false.
|
boolean |
hasWindowFunction(ITechnology techno)
Returns true if this query has a window or analytical function, otherwise false.
|
boolean |
isANSI() |
boolean |
isConstantQuery()
Return true if the query has no real source, but is projecting a set of constants in the select list.
|
boolean |
isDistinct()
Check if the query has a distinct clause.
|
boolean |
isPassive() |
boolean |
isPivot()
Check if the query is created from a pivot component.
|
boolean |
isScalarTableFunctionWithAggregate()
Check if the query is created from a scalar table function component with aggregate as input.
|
boolean |
isStagingQuery() |
boolean |
isSubquery() |
java.lang.String |
toString()
Return a string representation of this query.
|
getParentQuerygetCodeGenerationTemplate, getCodeGenerationTemplateName, getCustomTemplate, getKMName, getLeafLevelChildren, getMapPhysicalNode, getOrder, getParentAST, getParentOfType, getPropertyValue, getSourceLanguage, getSourceTechnology, getSourceText, getTargetLanguage, getTargetLocation, getTargetTechnology, getTargetText, hasCustomTemplate, hasSourceAndTargetText, isLeafLevelNode, isPushFromSourceequals, getClass, hashCode, notify, notifyAll, wait, wait, waitgetParentASTpublic java.util.List getSelectList()
public java.util.List getAliasList()
public boolean isPassive()
public boolean isDistinct()
public boolean isPivot()
public boolean isScalarTableFunctionWithAggregate()
public java.util.List getFromList()
throws GenerationException
GenerationExceptionpublic java.util.List getWhereList()
public java.lang.String getText()
throws GenerationException
getText in interface ITableFunctionParametergetText in class AbstractSyntaxTreeGenerationExceptionpublic java.util.Map getTemplateSubstitutionMap()
AbstractSyntaxTreegetTemplateSubstitutionMap in class AbstractSyntaxTreepublic java.util.List getChildren()
AbstractSyntaxTreegetChildren in interface ITableFunctionParametergetChildren in class AbstractSyntaxTreepublic java.lang.String getType()
AbstractSyntaxTreegetType in class AbstractSyntaxTreepublic boolean isANSI()
public java.util.List getGroupByList()
public java.util.List getHavingList()
public java.util.List getOrderByList()
public SqlQuery addJoin(MapPhysicalNode physicalNode, JoinTable.JoinType joinType, SqlQuery joinQuery, ArrayExpression[] joinConditionHolder, boolean addJoinCondition, boolean orderedJoin, SqlQuery.SelectMapContainer selectMapContainer, IMapComponent leftComponent, IMapComponent rightComponent, MapConnectorPoint leftPoint, MapConnectorPoint rightPoint, boolean inDataset, java.util.Set existingAliasSet, boolean optimizeLeftInlineViews, boolean isCombinedQuery) throws GenerationException
physicalNode - the physical node of join.joinType - The join type of this join to be added. Can be one of the following: INNER, LEFT OUTER, RIGHT OUTER, FULl OUTER, NATURAL, CROSS.joinQuery - The query to be joined with this query.joinCondition - The join condition expression for this join.orderedJoin - The indicator whether this is an ANSI join.selectMapContainer - The select map hash table. The hash key is a select item, and the value is a list of redirected select items inside subqueries.leftComponent - The component that contributes to the left side of the join.rightComponent - The component that contributes to the right side of the join.leftPoint - The connector point that contributes to the left side of the join.rightPoint - The connector point that contributes to the right side of the join.inDataset - Indicate if this is a join within a dataset.existingAliasSet - set of existing aliases used in the queryoptimizeLeftInlineViews - specifies whether inline views created for the left side, or source, should be pruned to include only those
attributes used downstream. This value should be true except for nth row lookup operations where all attributes from the source
should be included in the select list.isCombinedQuery - indicate whether this sqlquery is a combined query. Suppose we have a join with 3 inputs. The first call to addJoin() would process
INPUT1 and INPUT2, and create a combined query INPUT12. The next call will process INPUT12 and INPUT3. Here INPUT12 is a combined query.GenerationExceptionpublic java.util.List getSourceColumns()
throws AdapterException
AdapterExceptionpublic IColumn getExpressionColumn(Expression expr) throws AdapterException
AdapterExceptionpublic ILocation getSourceLocation()
throws GenerationException
AbstractSyntaxTreegetSourceLocation in class AbstractSyntaxTreeGenerationExceptionpublic java.util.List getExpressions()
AbstractSyntaxTreegetExpressions in class QueryClausepublic SqlQuery getInputQuery(int index) throws GenerationException
index - The index of the query.GenerationExceptionpublic int getInputQueryCount()
public java.lang.String getSetOperation()
public SqlQuery getSetOperand()
public TableReference getSourceTable(java.lang.String baseName)
baseName - The base table name of the source table.public java.util.Collection getSourceTables()
public java.lang.String toString()
toString in class java.lang.Objectpublic MapPhysicalNode getJournalizedSource()
public boolean hasJournalizedSource()
public boolean hasFilterWithAggregation()
public boolean hasAggregation()
public boolean hasWindowFunction(ITechnology techno)
techno - technology used to get list of aggregation functions to check against.public java.util.List getLateralViewList()
public boolean hasWindowFunction()
throws GenerationException
techno - technology used to get list of aggregation functions to check against.GenerationExceptionpublic java.util.List getSelectHints()
public boolean hasNonOrderedJoin()
public java.util.List getNonOrderedComponents()
public boolean isConstantQuery()
throws GenerationException
GenerationExceptionpublic java.lang.String getConstantFromClauseText()
throws GenerationException
GenerationExceptionpublic java.lang.String getConstantFromClauseText(boolean includeFromKeyword)
throws GenerationException
includeFromKeyword - If true, include the "FROM" keyword in the text, else just include the FROM table name.GenerationExceptionpublic boolean isStagingQuery()
public IMapComponent getQuerySourceComponent()
public boolean hasSourceReference()
public java.lang.String getColumnAliasSeparator()
public java.util.List getSubqueries()
throws GenerationException
GenerationExceptionpublic java.util.List getSourceTables(boolean includeSubqueries)
throws GenerationException
includeSubqueries - If true, include source tables referenced through subqueries.GenerationExceptionpublic boolean isSubquery()