Package org.apache.druid.query.groupby
Class ResultRow
- java.lang.Object
-
- org.apache.druid.query.groupby.ResultRow
-
public final class ResultRow extends Object
Used byGroupByQuery
for 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 ResultRow
copy()
Returns a copy of this row.static ResultRow
create(int size)
Create a row of a certain size, initialized to all nulls.boolean
equals(Object o)
static ResultRow
fromLegacyRow(Row row, GroupByQuery query)
Create a row based on a legacyRow
that was generated by a givenGroupByQuery
.Object
get(int i)
Object[]
getArray()
Get the backing array for this row (not a copy).long
getLong(int i)
int
hashCode()
int
length()
static ResultRow
of(Object... row)
Create a row from an array of objects.void
set(int i, Object o)
Map<String,Object>
toMap(GroupByQuery query)
Returns a Map representation of the data in this row.MapBasedRow
toMapBasedRow(GroupByQuery query)
Returns aRow
representation of the data in this row.String
toString()
-
-
-
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 legacyRow
that 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 aRow
representation of the data in this row.
-
-