Package org.apache.druid.query.groupby
Class ResultRow
- java.lang.Object
-
- org.apache.druid.query.groupby.ResultRow
-
public final class ResultRow extends Object
Used byGroupByQueryfor results. Each row is positional, and has the following fields, in order: - Timestamp (optional; only if granularity != ALL) - Dimensions (in order) - Aggregators (in order) - Post-aggregators (optional; in order, if present) ResultRows may sometimes be created without space reserved for post-aggregators, in contexts where it is known that post-aggregators will not be computed.- See Also:
GroupByQuery.getResultRowSignature(),GroupByQuery.getResultRowHasTimestamp(),GroupByQuery.getUniversalTimestamp(),GroupByQuery.getResultRowDimensionStart(),GroupByQuery.getResultRowAggregatorStart(),GroupByQuery.getResultRowPostAggregatorStart(),GroupByQuery.getResultRowSizeWithPostAggregators(),GroupByQuery.getResultRowSizeWithoutPostAggregators()
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ResultRowcopy()Returns a copy of this row.static ResultRowcreate(int size)Create a row of a certain size, initialized to all nulls.booleanequals(Object o)static ResultRowfromLegacyRow(Row row, GroupByQuery query)Create a row based on a legacyRowthat was generated by a givenGroupByQuery.Objectget(int i)Object[]getArray()Get the backing array for this row (not a copy).longgetLong(int i)inthashCode()intlength()static ResultRowof(Object... row)Create a row from an array of objects.voidset(int i, Object o)Map<String,Object>toMap(GroupByQuery query)Returns a Map representation of the data in this row.MapBasedRowtoMapBasedRow(GroupByQuery query)Returns aRowrepresentation of the data in this row.StringtoString()
-
-
-
Method Detail
-
create
public static ResultRow create(int size)
Create a row of a certain size, initialized to all nulls.
-
fromLegacyRow
public static ResultRow fromLegacyRow(Row row, GroupByQuery query)
Create a row based on a legacyRowthat was generated by a givenGroupByQuery. This is useful for deserializing rows that have come off the wire in the older format. (In the past, GroupBy query results were sequences ofRow, not ResultRow.)- Parameters:
row- legacy rowquery- query corresponding to the output ResultRow
-
getArray
public Object[] getArray()
Get the backing array for this row (not a copy).
-
getLong
public long getLong(int i)
-
length
public int length()
-
copy
public ResultRow copy()
Returns a copy of this row. The backing array will be copied as well.
-
toMap
public Map<String,Object> toMap(GroupByQuery query)
Returns a Map representation of the data in this row. Does not include the timestamp.
-
toMapBasedRow
public MapBasedRow toMapBasedRow(GroupByQuery query)
Returns aRowrepresentation of the data in this row.
-
-