Class ResultRow

java.lang.Object
org.apache.druid.query.groupby.ResultRow

public final class ResultRow extends Object
Used by GroupByQuery 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:
  • Method Details

    • of

      public static ResultRow of(Object... row)
      Create a row from an array of objects.
    • 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 legacy Row that was generated by a given GroupByQuery. This is useful for deserializing rows that have come off the wire in the older format. (In the past, GroupBy query results were sequences of Row, not ResultRow.)
      Parameters:
      row - legacy row
      query - query corresponding to the output ResultRow
    • getArray

      public Object[] getArray()
      Get the backing array for this row (not a copy).
    • set

      public void set(int i, @Nullable Object o)
    • get

      @Nullable public Object get(int i)
    • 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 a Row representation of the data in this row.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object