Package gudusoft.gsqlparser.nodes
Class TTable
Object
gudusoft.gsqlparser.nodes.TParseTreeNode
gudusoft.gsqlparser.nodes.TNodeWithAliasClause
gudusoft.gsqlparser.nodes.TTable
- All Implemented Interfaces:
IRelation,Visitable,Iterator<TSourceToken>
- Direct Known Subclasses:
TCTE
Represents various kinds of table source in from clause. Can also be a simple table/view name in create table and all other places.
result of
getTableType() can be one of:
- ftt_objectname, in from clause, a simple table/view name, reference:
tableName - ftt_subquery, is a subquery that retrieves rows from the database, also known as derived table. reference:
subquery - ftt_tableExpr,it's usually a table-valued expression., reference:
tableExpr - ftt_function, it's usually a table-valued function., reference:
funcCall ETableSource.rowList, it's constructed rows, reference:rowList- ftt_containsTable, CONTAINSTABLE clause of sql server. reference:
containsTable, type ofTContainsTable - ftt_freetextTable, FREETEXTTABLE clause of sql server. reference:
containsTable, type ofTContainsTable - ftt_openrowset, OPENROWSET clause of sql server. reference:
openRowSet, type ofTOpenRowSet - ftt_openxml, OPENXML clause of sql server. reference:
openXML, type ofTOpenXML - ftt_opendatasource, OPENDATASOURCE clause of sql server. reference:
openDatasource, type ofTOpenDatasource - ftt_openquery, OPENQUERY clause of sql server. reference:
openquery, type of (@link TOpenQuery)
-
Field Summary
FieldsFields inherited from class gudusoft.gsqlparser.nodes.TParseTreeNode
dbvendor, doubleLinkedTokenListToString, nodeActionAppend, nodeActionInsert, nodeActionRemove, nodeActionUnknown, nodeActionUpdate, nodeActionUpdateText, nodeChangeEndToken, nodeChangeStartToken -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAccept a visitorvoidAccept a visitor to iterate this class and sub-nodes of this classvoidaddAttribute(TAttributeNode node) booleancheckTableByName(String pTablename) booleanequalByName(String pTableName) Deprecated., this method is deprecated since version 3.3.1.0, don't use it in TSQLResolver2getColumnsFromSQLEnv(TSQLEnv sqlEnv) getCTE()DB2 data changegetDisplayName(boolean removeDBLink) If a star column is linked to this table, use this method to returns all underlying columns that represented by the star column.SQL Server for xml clauseGets the HASH BY clause for Teradata table functions.Deprecated.As of v2.1.0.0, please usegetSubquery()Deprecated., this method is deprecated since version 3.3.1.0, don't use it in TSQLResolver2Gets the LOCAL ORDER BY clause for Teradata table functions.getName()Deprecated.As of v1.6.0.1, usegetLinkedColumns()insteadValid whentableTypeis ftt_opendatasource.intintDeprecated.As of v1.6.2.4, replaced byTPivotedTableDeprecated.As of v2.3.6.9, please usegetValueClause()instead row constructor like this: '(' RW_VALUES MultiTargets ')'voidvoidvoidvoid主要是在处理列级别的信息, 它的主要目的是确保 JOIN 操作后的表对象包含所有参与 JOIN 的表的列信息,这对于后续的查询处理(特别是列引用解析)是必要的。voidvoidinitAttributesForUnnest(TSQLEnv sqlEnv, TSelectSqlStatement select) voidvoidinitAttributesFromSubquery(TSelectSqlStatement subquery, String prefix) voidInitialize a star attribute node (tableName.*) for this table.booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanisTableRefBelongToThisTable(TTableReference tableref) booleansearchColumn(TSelectSqlStatement select, String tableName, TObjectName pColumn, boolean pMustIn) intsearchColumnInAlias(TObjectName pColumn) voidsetCaseJoin(TCaseJoinClause caseJoin) voidsetColumnDefinitions(TColumnDefinitionList columnDefinitions) voidsetColumnListInTempTable(TResultColumnList columnListInTempTable) voidsetContainsTable(TContainsTable containsTable) booleanvoidsetCteColomnReferences(TObjectNameList cteColomnReferences) voidsetCTEName(boolean CTEName) voidsetDatachangeTable(TDataChangeTable datachangeTable) voidsetEffectType(ETableEffectType effectType) voidsetFlashback(TFlashback flashback) voidsetForXMLClause(TForXMLClause forXMLClause) voidsetFromTableList(TFromTableList fromTableList) voidsetFuncCall(TFunctionCall funcCall) voidsetHashByClause(THashByClause hashByClause) Sets the HASH BY clause for Teradata table functions.voidsetHiveFromQuery(THiveFromQuery hiveFromQuery) voidsetJoinExpr(TJoinExpr joinExpr) voidsetJsonTable(TJsonTable jsonTable) voidsetLateralViewList(ArrayList<TLateralView> lateralViewList) voidsetLinkedColumns(TObjectNameList linkedColumns) voidsetLinkTable(boolean isLinkTable) Deprecated.As of v1.8.4.6, set insetLinkTable(gudusoft.gsqlparser.nodes.TTable)voidsetLinkTable(TTable linkTable) voidsetLocalOrderBy(TOrderBy localOrderBy) Sets the LOCAL ORDER BY clause for Teradata table functions.voidsetObjectNameReferences(TObjectNameList objectNameReferences) voidsetOnlyKeyword(boolean onlyKeyword) voidsetOpenDatasource(TOpenDatasource openDatasource) voidsetOpenquery(TOpenQuery openquery) voidsetOpenRowSet(TOpenRowSet openRowSet) voidsetOpenXML(TOpenXML openXML) voidsetOuterClause(TInformixOuterClause outerClause) voidsetOutputMerge(TMergeSqlStatement outputMerge) voidsetParenthesisAfterAliasCount(int parenthesisAfterAliasCount) voidsetParenthesisCount(int parenthesisCount) voidsetPartitionExtensionClause(TPartitionExtensionClause partitionExtensionClause) voidsetPivotClause(TPivotClause pivotClause) voidsetPivotedTable(TPivotedTable pivotedTable) voidsetPropertyFromObjectName(TObjectName objectName, ETableEffectType tableEffectType) voidsetPxGranule(TPxGranule pxGranule) voidsetResolved(boolean resolved) voidsetResolvedTable(TSQLTable resolvedTable) voidsetRowList(TMultiTargetList rowList) voidsetSourceTableOfPivot(TTable sourceTableOfPivot) voidvoidsetStageReference(TStageReference stageReference) voidsetSubquery(TSelectSqlStatement subquery) voidsetTableExpr(TExpression tableExpr) voidsetTableHintList(TPTNodeList<TTableHint> tableHintList) voidsetTableKeyword(boolean tableKeyword) voidsetTableName(TObjectName tableName) voidsetTableProperties(TPTNodeList<THiveKeyValueProperty> tableProperties) voidsetTablerefs(TTableReferenceList tablerefs) voidsetTableSample(TTableSample tableSample) voidsetTableType(ETableSource tableType) voidsetTdUnpivot(TTDUnpivot tdUnpivot) voidsetTimeTravelClause(TAtBeforeClause timeTravelClause) voidsetUnnestClause(TUnnestClause unnestClause) voidsetValueClause(TValueClause valueClause) voidsetXmlTable(TXmlTable xmlTable) intsize()toString()Tf there is no alias clause of this node, then toString() is the same asTParseTreeNodeMethods inherited from class gudusoft.gsqlparser.nodes.TNodeWithAliasClause
getAliasClause, setAliasClauseMethods inherited from class gudusoft.gsqlparser.nodes.TParseTreeNode
addAllMyTokensToTokenList, addToTokenChain, appendNewNode, calculateTokenCount, doAppendNewNode, doParse, fastSetString, getAnchorNode, getColumnNo, getCommentAfterNode, getCommentBeforeNode, getCompactString, getDummyTag, getEndToken, getEvaluateDatatype, getEvalValue, getGsqlparser, getLineNo, getLocation, getMd5, getNodeStatus, getNodeType, getParentObjectName, getPlainText, getStartToken, getTokenCount, hasNext, init, init, init, init, init, init, insertAfterAToken, insertNewNodeBeforeMe, isChanged, isTokensInChain, next, refreshAllNodesTokenCount, remove, removeAllMyTokensFromTokenList, removeTokens, removeTokensBetweenNodes, removeTokensBetweenToken, replaceWithNewNode, resetIterator, setAnchorNode, setChanged, setDummyTag, setEndToken, setEndToken, setEndToken, setEndToken, setEndToken, setEndTokenDirectly, setEvaluateDatatype, setEvalValue, setGsqlparser, setIncludingComment, setLocation, setNewSubNode, setNodeStatus, setNodeType, setParent, setPlainText, setStartToken, setStartToken, setStartToken, setStartToken, setStartTokenDirectly, setString, setString2, subNodeInNode, toScript, toString2Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
PIVOT_CLAUSE_ALIAS
- See Also:
-
UNPIVOT_CLAUSE_ALIAS
- See Also:
-
TABLE_COLLECTION_ALIAS
- See Also:
-
subquery
-
tablerefs
-
-
Constructor Details
-
TTable
-
TTable
public TTable()
-
-
Method Details
-
getAttributes
Deprecated., this method is deprecated since version 3.3.1.0, don't use it in TSQLResolver2Description copied from interface:IRelation每个 relation 包含的 attributes 当它为 base table 时,这些 attributes 的来源有三种可能 1. 来自数据库的 metadata,第一次 resolve 时就可以获取,来自 sqlenv 2. 来自 create table ddl,第一次 resolve 时就可以获取,来自 sqlenv 3. 来自 sql script,第二次 resolve 时,来自relation的 referenceAttribute 属性。 第一、二中来源是可靠的来源,attributes应该是完整的,第三种推断自 sql script,attributes很可能是不完整的。- Specified by:
getAttributesin interfaceIRelation- Returns:
-
getRelationName
- Specified by:
getRelationNamein interfaceIRelation
-
size
-
setStageReference
-
getStageReference
-
setTimeTravelClause
-
getTimeTravelClause
-
setCaseJoin
-
getCaseJoin
-
getStageName
-
initStarAttribute
Initialize a star attribute node (tableName.*) for this table. This is used for regular tables (without DDL/metadata) in contexts where they need to compete with subqueries that have star columns. For example, in MERGE statements, the target table needs a star attribute so that unqualified columns in the ON clause can be resolved to it instead of being incorrectly pushed down through the source subquery's star column. -
initAttributeForXMLTable
-
initAttributeForTableFunction
-
initAttributeForRowList
-
initAttributesFromCTE
-
initAttributesFromSubquery
-
getDisplayName
-
getDisplayName
-
initAttributesForPivotTable
-
initAttributesForJoin
主要是在处理列级别的信息, 它的主要目的是确保 JOIN 操作后的表对象包含所有参与 JOIN 的表的列信息,这对于后续的查询处理(特别是列引用解析)是必要的。 -
initAttributesForUnnest
-
addAttribute
-
getAttributesReferenceToThisRelation
-
setResolvedTable
-
setResolved
-
getResolvedTable
-
isResolved
-
getColumnsFromSQLEnv
-
setJoinExpr
-
getJoinExpr
-
setForXMLClause
-
getForXMLClause
SQL Server for xml clause- Returns:
- SQL Server for xml clause
-
getColumnDefinitions
-
getHashByClause
Gets the HASH BY clause for Teradata table functions.- Returns:
- the HASH BY clause, or null if not specified
-
setHashByClause
Sets the HASH BY clause for Teradata table functions.- Parameters:
hashByClause- the HASH BY clause
-
getLocalOrderBy
Gets the LOCAL ORDER BY clause for Teradata table functions.- Returns:
- the LOCAL ORDER BY clause, or null if not specified
-
setLocalOrderBy
Sets the LOCAL ORDER BY clause for Teradata table functions.- Parameters:
localOrderBy- the LOCAL ORDER BY clause
-
setSqlEnv
-
getSqlEnv
-
getValueClause
-
setValueClause
-
setSourceTableOfPivot
-
getSourceTableOfPivot
-
setJsonTable
-
getJsonTable
-
setPropertyFromObjectName
-
setTdUnpivot
-
getTdUnpivot
-
setUnnestClause
-
getUnnestClause
-
setColumnListInTempTable
-
getColumnListInTempTable
-
setPxGranule
-
getPxGranule
-
setFlashback
-
getFlashback
-
setTableKeyword
-
setOnlyKeyword
-
isTableKeyword
-
isOnlyKeyword
-
setParenthesisCount
-
setParenthesisAfterAliasCount
-
getParenthesisCount
-
getParenthesisAfterAliasCount
-
setOutputMerge
-
getOutputMerge
-
setPivotedTable
-
getPivotedTable
-
setEffectType
-
getEffectType
-
setLinkTable
-
getLinkTable
-
isLinkTable
-
setLinkTable
Deprecated.As of v1.8.4.6, set insetLinkTable(gudusoft.gsqlparser.nodes.TTable) -
getAliasName
-
equalByName
-
setTableProperties
-
getTableProperties
- Returns:
- hive table property list
-
setLateralViewList
-
getLateralViewList
-
setTableSample
-
getTableSample
-
setPartitionExtensionClause
-
getPartitionExtensionClause
-
setOuterClause
-
getOuterClause
-
setFromTableList
-
getFromTableList
-
getXmlTable
-
setXmlTable
-
setTableHintList
-
getTableHintList
-
getOpenquery
-
getSubquery
-
setOpenquery
-
setOpenDatasource
-
getOpenDatasource
Valid whentableTypeis ftt_opendatasource.- Returns:
-
setOpenXML
-
getOpenXML
-
getOpenRowSet
-
setOpenRowSet
-
getContainsTable
-
setContainsTable
-
getFuncCall
-
setFuncCall
-
getRowList
Deprecated.As of v2.3.6.9, please usegetValueClause()instead row constructor like this: '(' RW_VALUES MultiTargets ')'- Returns:
- TMultiTargetList
-
isBaseTable
-
setCteColomnReferences
-
getCteColomnReferences
-
setObjectNameReferences
-
setCTE
-
getCTE
-
isCTEName
-
setCTEName
-
setHiveFromQuery
-
getHiveFromQuery
Deprecated.As of v2.1.0.0, please usegetSubquery()- Returns:
-
getTableExpr
-
setTableExpr
-
setTableType
-
getTableType
- Returns:
- what's kind of type this table is.
ETableSource.objectname, in from clause, a simple table/view name, reference:tableNameETableSource.subquery, is a subquery that retrieves rows from the database, also known as derived table. reference:subqueryETableSource.tableExpr,it's usually a table-valued expression., reference:tableExprETableSource.function, it's usually a table-valued function., reference:funcCallETableSource.rowList, it's constructed rows, reference:rowListETableSource.containsTable, CONTAINSTABLE clause of sql server. reference:containsTable, type ofTContainsTableETableSource.freetextTable, FREETEXTTABLE clause of sql server. reference:containsTable, type ofTContainsTableETableSource.openrowset, OPENROWSET clause of sql server. reference:openRowSet, type ofTOpenRowSetETableSource.openxml, OPENXML clause of sql server. reference:openXML, type ofTOpenXMLETableSource.opendatasource, OPENDATASOURCE clause of sql server. reference:openDatasource, type ofTOpenDatasourceETableSource.openquery, OPENQUERY clause of sql server. reference:openquery, type of (@link TOpenQuery)
-
setTableName
-
getTableName
-
getName
-
getPrefixServer
-
getPrefixDatabase
-
getPrefixSchema
-
isIncludeColumnAlias
-
searchColumnInAlias
-
checkTableByName
-
searchColumn
public boolean searchColumn(TSelectSqlStatement select, String tableName, TObjectName pColumn, boolean pMustIn) -
getLinkedColumns
Deprecated., this method is deprecated since version 3.3.1.0, don't use it in TSQLResolver2- Returns:
-
getFullNameWithAliasString
-
getFullName
-
getObjectNameReferences
Deprecated.As of v1.6.0.1, usegetLinkedColumns()instead- Returns:
- column name related to this table.
-
setPivotClause
-
getPivotClause
Deprecated.As of v1.6.2.4, replaced byTPivotedTable- Returns:
-
setDatachangeTable
-
getDatachangeTable
DB2 data change- Returns:
-
isTableRefBelongToThisTable
-
accept
Description copied from class:TParseTreeNodeAccept a visitor- Specified by:
acceptin interfaceVisitable- Overrides:
acceptin classTParseTreeNode- Parameters:
v- visitor is a descendant class ofTParseTreeVisitor
-
setColumnDefinitions
-
acceptChildren
Description copied from class:TParseTreeNodeAccept a visitor to iterate this class and sub-nodes of this class- Specified by:
acceptChildrenin interfaceVisitable- Overrides:
acceptChildrenin classTParseTreeNode- Parameters:
v- visitor is a descendant class ofTParseTreeVisitor
-
setRowList
-
setSubquery
-
setLinkedColumns
-
setTablerefs
-
getExpandedStarColumns
If a star column is linked to this table, use this method to returns all underlying columns that represented by the star column.
The returned column always prefixed with
1. the table alias.
2. the table name
3. the alias of query (if the table is a subquery)
4. empty if the no alias is specified for a subquery- Returns:
- a list of columns
-
toString
Description copied from class:TNodeWithAliasClauseTf there is no alias clause of this node, then toString() is the same asTParseTreeNodeOtherwise, return text of node only, don't include text of alias clause.
If this node was modified by
TParseTreeNode.setString(String), then node text including alias node text was replaced by new string.- Overrides:
toStringin classTNodeWithAliasClause- Returns:
- 节点对应的SQL字符串。
-