public class GroupBy extends Object implements QueryNode
GroupBy defines a single dimension of record grouping
for a containing Statement operation. Basically, a
GroupBy represents an Endeca property or dimension by which
records will be grouped. Input records for the containing
Statement operation are grouped together by common assignment
from the GroupBy property or dimension.
GroupBy instances are encapsulated in a GroupByList,
which in turn is set in the Statement object.| Constructor and Description |
|---|
GroupBy(String groupingKey)
Constructs a new
GroupBy which will request
aggregation of records into groups based on the Endeca property
or dimension named groupingKey. |
GroupBy(String groupingKey,
int depth)
Constructs a new
GroupBy which will request
aggregation of records into groups based on the Endeca property
or dimension named groupingKey. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Indicates whether this
GroupBy has an equivalence
to a reference GroupBy specified by obj. |
int |
getDepth()
Gets the dimension depth for the aggregates defined by
this
GroupBy. |
String |
getFieldName()
Gets the name of the grouping property or dimension for this
GroupBy. |
void |
setDepth(int depth)
Sets the dimension depth for the aggregates defined by
this
GroupBy. |
void |
setFieldName(String key)
Sets the name of the grouping property or dimension for this
GroupBy. |
String |
toString()
Returns the string form of this
GroupBy. |
String |
toWire()
Returns the wire format of this
GroupBy. |
void |
validateSyntax()
Validates the syntax of this
GroupBy. |
public GroupBy(String groupingKey)
GroupBy which will request
aggregation of records into groups based on the Endeca property
or dimension named groupingKey. For example, this code:
GroupByList g = new GroupByList();
g.add(new GroupBy("Year"));
performs a leaf-level grouping of records based on the Endeca
dimension named Year.groupingKey - the name of the Endeca property or dimension
by which the records will be aggregated.public GroupBy(String groupingKey, int depth)
GroupBy which will request
aggregation of records into groups based on the Endeca property
or dimension named groupingKey.
For dimensions, the grouping will depend on the value's ancestor
at depth from the root of the dimension's hierarchy.
For example, if a Region dimension contains a hierarchy of Country,
State, and City, and the grouping was desired at the State level
(one level below the root of the dimension hierarchy), the
constructor code would be:
GroupByList g = new GroupByList();
g.add(new GroupBy("Region",1));
Note that a depth of zero does not
indicate grouping at the root of the hierarchy, but rather it denotes that
depth will not be taken into account at all, so grouping will be
performed based on the values encountered.groupingKey - the name of the Endeca property or dimension
by which the records will be aggregated.depth - the level of a dimension hierarchy at which
the grouping will be performed.public void setFieldName(String key)
GroupBy.key - the name of the Endeca property or dimension
by which the records will be grouped.public String getFieldName()
GroupBy.public void setDepth(int depth)
GroupBy.depth - the level of a dimension hierarchy at which
the grouping will be performed.public int getDepth()
GroupBy.public boolean equals(Object obj)
GroupBy has an equivalence
to a reference GroupBy specified by obj.
The method returns one of these results:
false if the reference GroupBy (the
obj object) is null or is not of type GroupBy.true if the field-names of both GroupBy
objects are null.false if the field-name of one GroupBy
is null and the other is non-null.java.lang.Object.equals method
if both field-names are non-null.GroupBy objects are not compared.public String toString()
GroupBy. These are of the format:
"grouping-key-name" or "grouping-key-name:3".
For example, the string:
Region:2
is returned if the grouping key is a dimension named Region
with a grouping level of 2 (that is, two levels below the root of the dimension hierarchy).public String toWire()
GroupBy. This method is not
intended for public use because the wire format is subject to change.public void validateSyntax()
throws SyntaxException
GroupBy.
A GroupBy is valid if the grouping key name is
non-null and non-empty, and the depth is non-negative.validateSyntax in interface QueryNodeSyntaxException - if the syntax requirements are not satisfied.© 2003, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle and/or its affiliates Confidential