Class TGroupBy
- All Implemented Interfaces:
Visitable,Iterator<TSourceToken>
Specify the GROUP BY clause if you want the database to group the selected rows based on the value of expr(s) for each row and return a single row of summary information for each group.
If this clause contains CUBE or ROLLUP extensions, then the database produces superaggregate groupings in addition to the regular groupings.
Use the HAVING clause to restrict the groups of returned rows to those groups for which the specified condition is TRUE. If you omit this clause, then the database returns summary rows for all groups.
-
Field Summary
Fields 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 classvoiddoParse(TCustomSqlStatement psql, ESqlClause plocation) Analyze the sub-nodes inside this node.getALL()Gets the ALL token for GROUP BY ALL syntax.getBY()getGROUP()Restrict the groups of returned rows to those groups for which the specified condition is TRUE.getItems()voidInitialize a query tree node.voidbooleanReturns whether this GROUP BY clause uses the ALL modifier.booleanbooleanvoidsetALL(TSourceToken ALL) Sets the ALL token for GROUP BY ALL syntax.voidsetAllModifier(boolean allModifier) Sets whether this GROUP BY clause uses the ALL modifier.voidsetBindings(TPTNodeList<TBinding> bindings) voidsetBY(TSourceToken BY) voidsetCubeModifier(boolean cubeModifier) voidsetGROUP(TSourceToken GROUP) voidsetHAVING(TSourceToken HAVING) voidsetHavingClause(TExpression havingClause) voidsetItems(TGroupByItemList items) voidsetQualifyClause(TQualifyClause qualifyClause) voidsetRollupModifier(boolean rollupModifier) Methods inherited from class gudusoft.gsqlparser.nodes.TParseTreeNode
addAllMyTokensToTokenList, addToTokenChain, appendNewNode, calculateTokenCount, doAppendNewNode, 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, 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, toString, toString2Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
TGroupBy
public TGroupBy()
-
-
Method Details
-
setQualifyClause
-
getQualifyClause
-
getBindings
-
setCubeModifier
-
isCubeModifier
-
setRollupModifier
-
isRollupModifier
-
setAllModifier
Sets whether this GROUP BY clause uses the ALL modifier.GROUP BY ALL is a shorthand notation to add all SELECT-list expressions not containing aggregate functions as group expressions.
Applies to Databricks SQL Databricks Runtime 12.2 LTS and above.
- Parameters:
allModifier- true if GROUP BY ALL is used, false otherwise
-
isAllModifier
Returns whether this GROUP BY clause uses the ALL modifier.GROUP BY ALL automatically groups by all non-aggregate expressions in the SELECT clause.
- Returns:
- true if GROUP BY ALL is used, false otherwise
-
setBY
-
setGROUP
-
setHAVING
-
setALL
Sets the ALL token for GROUP BY ALL syntax.- Parameters:
ALL- the ALL token
-
getBY
-
getGROUP
-
getHAVING
-
getALL
Gets the ALL token for GROUP BY ALL syntax.- Returns:
- the ALL token, or null if GROUP BY ALL is not used
-
getHavingClause
Restrict the groups of returned rows to those groups for which the specified condition is TRUE.If you omit this clause, then the database returns summary rows for all groups.
- Returns:
-
getItems
- Returns:
- Items in group by clause, can be expr, rollup_cube_clause and grouping_sets_clause.
- See Also:
-
setHavingClause
-
init
Description copied from class:TParseTreeNodeInitialize a query tree node. Used internally- Overrides:
initin classTParseTreeNode- Parameters:
arg1- first argument
-
init
- Overrides:
initin classTParseTreeNode
-
doParse
Description copied from class:TParseTreeNodeAnalyze the sub-nodes inside this node. Such as build the relationship between table and column.- Overrides:
doParsein classTParseTreeNode- Parameters:
psql- SQL statement this node belongs toplocation- SQL clause this node belongs to
-
setBindings
-
accept
Description copied from class:TParseTreeNodeAccept a visitor- Specified by:
acceptin interfaceVisitable- Overrides:
acceptin classTParseTreeNode- Parameters:
v- visitor is a descendant class ofTParseTreeVisitor
-
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
-
setItems
-