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 |
---|---|
boolean |
containsNonInlineableVariableReference(Binding binding)
Determine whether the clause contains a reference to a local variable binding that cannot be inlined
|
GroupByClause |
copy(FLWORExpression flwor)
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(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.
|
String |
toString() |
gatherVariableReferences, getConfiguration, getLocation, getPackageData, refineVariableType, setLocation, setPackageData, 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)
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)
public void processGroup(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 requiredCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.