public class TGroupBy extends TParseTreeNode
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.
dbvendor, doubleLinkedTokenListToString, nodeActionAppend, nodeActionInsert, nodeActionRemove, nodeActionUnknown, nodeActionUpdate, nodeActionUpdateText, nodeChangeEndToken, nodeChangeStartToken| Constructor and Description |
|---|
TGroupBy() |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(TParseTreeVisitor v)
Accept a visitor
|
void |
acceptChildren(TParseTreeVisitor v)
Accept a visitor to iterate this class and sub-nodes of this class
|
void |
doParse(TCustomSqlStatement psql,
ESqlClause plocation)
Analyze the sub-nodes inside this node.
|
TSourceToken |
getALL()
Gets the ALL token for GROUP BY ALL syntax.
|
TPTNodeList<TBinding> |
getBindings() |
TSourceToken |
getBY() |
TSourceToken |
getGROUP() |
TSourceToken |
getHAVING() |
TExpression |
getHavingClause()
Restrict the groups of returned rows to those groups for which the specified condition is TRUE.
|
TGroupByItemList |
getItems() |
TQualifyClause |
getQualifyClause() |
void |
init(Object arg1)
Initialize a query tree node.
|
void |
init(Object arg1,
Object arg2) |
boolean |
isAllModifier()
Returns whether this GROUP BY clause uses the ALL modifier.
|
boolean |
isCubeModifier() |
boolean |
isRollupModifier() |
boolean |
isTotalsModifier()
Returns whether this GROUP BY clause uses the WITH TOTALS modifier.
|
void |
setALL(TSourceToken ALL)
Sets the ALL token for GROUP BY ALL syntax.
|
void |
setAllModifier(boolean allModifier)
Sets whether this GROUP BY clause uses the ALL modifier.
|
void |
setBindings(TPTNodeList<TBinding> bindings) |
void |
setBY(TSourceToken BY) |
void |
setCubeModifier(boolean cubeModifier) |
void |
setGROUP(TSourceToken GROUP) |
void |
setHAVING(TSourceToken HAVING) |
void |
setHavingClause(TExpression havingClause) |
void |
setItems(TGroupByItemList items) |
void |
setQualifyClause(TQualifyClause qualifyClause) |
void |
setRollupModifier(boolean rollupModifier) |
void |
setTotalsModifier(boolean totalsModifier)
Sets whether this GROUP BY clause uses the WITH TOTALS modifier.
|
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, 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, toString2clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEachRemainingpublic TGroupBy()
public void setQualifyClause(TQualifyClause qualifyClause)
public TQualifyClause getQualifyClause()
public TPTNodeList<TBinding> getBindings()
public void setCubeModifier(boolean cubeModifier)
public boolean isCubeModifier()
public void setRollupModifier(boolean rollupModifier)
public boolean isRollupModifier()
public void setTotalsModifier(boolean totalsModifier)
WITH TOTALS adds an extra row with totals to the result, which is the sum across all values in the column.
Applies to ClickHouse.
totalsModifier - true if WITH TOTALS is used, false otherwisepublic boolean isTotalsModifier()
WITH TOTALS adds an extra row with totals to the result.
public void setAllModifier(boolean allModifier)
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.
allModifier - true if GROUP BY ALL is used, false otherwisepublic boolean isAllModifier()
GROUP BY ALL automatically groups by all non-aggregate expressions in the SELECT clause.
public void setBY(TSourceToken BY)
public void setGROUP(TSourceToken GROUP)
public void setHAVING(TSourceToken HAVING)
public void setALL(TSourceToken ALL)
ALL - the ALL tokenpublic TSourceToken getBY()
public TSourceToken getGROUP()
public TSourceToken getHAVING()
public TSourceToken getALL()
public TExpression getHavingClause()
If you omit this clause, then the database returns summary rows for all groups.
public TGroupByItemList getItems()
TExpression,
TRollupCube,
TGroupingSetpublic void setHavingClause(TExpression havingClause)
public void init(Object arg1)
TParseTreeNodeinit in class TParseTreeNodearg1 - first argumentpublic void init(Object arg1, Object arg2)
init in class TParseTreeNodepublic void doParse(TCustomSqlStatement psql, ESqlClause plocation)
TParseTreeNodedoParse in class TParseTreeNodepsql - SQL statement this node belongs toplocation - SQL clause this node belongs topublic void setBindings(TPTNodeList<TBinding> bindings)
public void accept(TParseTreeVisitor v)
TParseTreeNodeaccept in interface Visitableaccept in class TParseTreeNodev - visitor is a descendant class of TParseTreeVisitorpublic void acceptChildren(TParseTreeVisitor v)
TParseTreeNodeacceptChildren in interface VisitableacceptChildren in class TParseTreeNodev - visitor is a descendant class of TParseTreeVisitorpublic void setItems(TGroupByItemList items)