public class GroupByClause extends Clause
Modifier and Type | Class and Description |
---|---|
static class |
GroupByClause.ObjectToBeGrouped
Inner class representing the contents of a tuple from the pre-grouping tuple stream;
a set of such objects consitutes a group.
|
class |
GroupByClause.TupleComparisonKey
Inner class representing a tuple comparison key: that is, an arbitrary object whose equals() and hashCode()
methods can be used to test whether two tuples have equivalent grouping keys
|
COUNT, FOR, GROUPBYCLAUSE, LET, ORDERBYCLAUSE, TRACE, WHERE, WINDOW
Constructor and Description |
---|
GroupByClause(Configuration config)
Create a group-by clause
|
Modifier and Type | Method and Description |
---|---|
void |
addToPathMap(PathMap pathMap,
PathMap.PathMapNodeSet pathMapNodeSet)
Collect information about the navigation paths followed by this clause, for document projection purposes
|
boolean |
containsNonInlineableVariableReference(Binding binding)
Determine whether the clause contains a reference to a local variable binding that cannot be inlined
|
GroupByClause |
copy(FLWORExpression flwor,
RebindingMap rebindings)
Create a copy of this clause
|
void |
explain(ExpressionPresenter out)
Diagnostic print of expression structure.
|
int |
getClauseKey()
Get a keyword identifying what kind of clause this is
|
GroupByClause.TupleComparisonKey |
getComparisonKey(Tuple t,
GenericAtomicComparer[] comparers)
Callback to get the comparison key for a tuple.
|
TupleExpression |
getGroupingTupleExpression()
Get the tuple expression that evaluates all the grouping variables, returning the values these variables
take in the input stream
|
TuplePull |
getPullStream(TuplePull base,
XPathContext context)
Get a tuple stream that implements the functionality of this clause, taking its
input from another tuple stream which this clause modifies
|
TuplePush |
getPushStream(TuplePush destination,
XPathContext context)
Get a push-mode tuple stream that implements the functionality of this clause, supplying its
output to another tuple stream
|
LocalVariableBinding[] |
getRangeVariables()
Get the variables bound by this clause
|
TupleExpression |
getRetainedTupleExpression()
Get the tuple expression that evaluates all the non-grouping variables, returning the values these variables
take in the grouping input stream
|
void |
initGroupingTupleExpression(FLWORExpression flwor,
TupleExpression expr)
Initialize a tuple expression that evaluates all the grouping variables, returning the values these variables
take in the input stream
|
void |
initRetainedTupleExpression(FLWORExpression flwor,
TupleExpression expr)
Initialize a tuple expression that evaluates all the non-grouping variables, returning the values these variables
take in the grouping input stream
|
void |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
Optimize any expressions contained within this clause
|
void |
processGroup(java.util.List<GroupByClause.ObjectToBeGrouped> group,
XPathContext context)
Process a group of tuples from the input stream to generate a single tuple in the output stream.
|
void |
processOperands(OperandProcessor processor)
Process the subexpressions of this clause
|
void |
setComparers(GenericAtomicComparer[] comparers)
Set the comparers used for the grouping keys.
|
void |
setGroupingTupleExpression(TupleExpression expr)
Set a tuple expression that evaluates all the grouping variables, returning the values these variables
take in the input stream
|
void |
setRetainedTupleExpression(TupleExpression expr)
Set a tuple expression that evaluates all the non-grouping variables, returning the values these variables take
in the grouping input stream
|
void |
setVariableBindings(LocalVariableBinding[] bindings)
Set the bindings of new variables created by the grouping clause, which constitute the variables
appearing in the output (post-grouping) tuple stream.
|
java.lang.String |
toString() |
gatherVariableReferences, getConfiguration, getLocation, getPackageData, isRepeated, refineVariableType, setLocation, setPackageData, setRepeated, toShortString, typeCheck
public GroupByClause(Configuration config)
config
- the Saxon configurationpublic int getClauseKey()
Clause
getClauseKey
in class Clause
public boolean containsNonInlineableVariableReference(Binding binding)
Clause
containsNonInlineableVariableReference
in class Clause
binding
- the binding for the local variable in questionpublic GroupByClause copy(FLWORExpression flwor, RebindingMap rebindings)
Clause
public void initRetainedTupleExpression(FLWORExpression flwor, TupleExpression expr)
flwor
- the containing FLWORExpressionexpr
- the tuple expressionpublic void setRetainedTupleExpression(TupleExpression expr)
expr
- the tuple expressionpublic TupleExpression getRetainedTupleExpression()
public void optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
Clause
optimize
in class Clause
visitor
- the ExpressionVisitor, providing access to static context informationcontextItemType
- the type of the context itemXPathException
- if any error is detectedpublic void initGroupingTupleExpression(FLWORExpression flwor, TupleExpression expr)
flwor
- the containing FLWORExpressionexpr
- the tuple expressionpublic void setGroupingTupleExpression(TupleExpression expr)
expr
- the tuple expressionpublic TupleExpression getGroupingTupleExpression()
public void setVariableBindings(LocalVariableBinding[] bindings)
bindings
- the bindings of the variables created in the output streampublic LocalVariableBinding[] getRangeVariables()
getRangeVariables
in class Clause
public void setComparers(GenericAtomicComparer[] comparers)
comparers
- the comparers for grouping keys.public TuplePull getPullStream(TuplePull base, XPathContext context)
getPullStream
in class Clause
base
- the input tuple streamcontext
- the XPath dynamic evaluation contextpublic TuplePush getPushStream(TuplePush destination, XPathContext context)
getPushStream
in class Clause
destination
- the output tuple streamcontext
- the dynamic evaluation contextpublic void processOperands(OperandProcessor processor) throws XPathException
processOperands
in class Clause
processor
- the expression processor used to process the subexpressionsXPathException
- if any error is detectedpublic void explain(ExpressionPresenter out) throws XPathException
explain
in class Clause
out
- the expression presenter used to display the structureXPathException
public java.lang.String toString()
toString
in class java.lang.Object
public void processGroup(java.util.List<GroupByClause.ObjectToBeGrouped> group, XPathContext context) throws XPathException
group
- the group of input tuplescontext
- the XPath dynamic evaluation contextXPathException
- if a dynamic error occurspublic GroupByClause.TupleComparisonKey getComparisonKey(Tuple t, GenericAtomicComparer[] comparers)
t
- the tuple whose comparison key is requiredpublic void addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
Clause
addToPathMap
in class Clause
pathMap
- the path map in which the data is to be collectedpathMapNodeSet
- the path map node set representing the paths to the context itemCopyright (c) 2004-2018 Saxonica Limited. All rights reserved.