Class ListBasedInputRow

java.lang.Object
org.apache.druid.data.input.ListBasedInputRow
All Implemented Interfaces:
Comparable<Row>, InputRow, Row

public class ListBasedInputRow extends Object implements InputRow
Input row backed by a List. This implementation is most useful when the columns and dimensions are known ahead of time, prior to encountering any data. It is used in concert with ListBasedInputRowAdapter, which enables
  • Constructor Details

    • ListBasedInputRow

      public ListBasedInputRow(RowSignature signature, org.joda.time.DateTime timestamp, List<String> dimensions, List<Object> data)
      Create a row.
      Parameters:
      signature - signature; must match the "data" list
      timestamp - row timestamp
      dimensions - dimensions to be reported by getDimensions()
      data - row data
  • Method Details

    • parse

      public static InputRow parse(RowSignature signature, TimestampSpec timestampSpec, List<String> dimensions, List<Object> data)
      Create a row and parse a timestamp. Throws ParseException if the timestamp cannot be parsed.
      Parameters:
      signature - signature; must match the "data" list
      timestampSpec - timestamp spec
      dimensions - dimensions to be reported by getDimensions()
      data - row data
    • getDimensions

      public List<String> getDimensions()
      Description copied from interface: InputRow
      Returns the dimensions that exist in this row.
      Specified by:
      getDimensions in interface InputRow
      Returns:
      the dimensions that exist in this row.
    • getTimestampFromEpoch

      public long getTimestampFromEpoch()
      Description copied from interface: Row
      Returns the timestamp from the epoch in milliseconds. If the event happened _right now_, this would return the same thing as System.currentTimeMillis();
      Specified by:
      getTimestampFromEpoch in interface Row
      Returns:
      the timestamp from the epoch in milliseconds.
    • getTimestamp

      public org.joda.time.DateTime getTimestamp()
      Description copied from interface: Row
      Returns the timestamp from the epoch as an org.joda.time.DateTime. If the event happened _right now_, this would return the same thing as new DateTime();
      Specified by:
      getTimestamp in interface Row
      Returns:
      the timestamp from the epoch as an org.joda.time.DateTime object.
    • getDimension

      public List<String> getDimension(String dimension)
      Description copied from interface: Row
      Returns the list of dimension values for the given column name.

      Specified by:
      getDimension in interface Row
      Parameters:
      dimension - the column name of the dimension requested
      Returns:
      the list of values for the provided column name
    • getRaw

      @Nullable public Object getRaw(String columnName)
      Description copied from interface: Row
      Returns the raw dimension value for the given column name. This is different from Row.getDimension(java.lang.String) which converts all values to strings before returning them.
      Specified by:
      getRaw in interface Row
      Parameters:
      columnName - the column name of the dimension requested
      Returns:
      the value of the provided column name
    • getRaw

      @Nullable public Object getRaw(int columnNumber)
    • getMetric

      @Nullable public Number getMetric(String metric)
      Description copied from interface: Row
      Returns the metric column value for the given column name. This method is different from Row.getRaw(java.lang.String) in two aspects: 1. If the column is absent in the row, null will be returned. 2. If the column has string value, an attempt is made to parse this value as a number.
      Specified by:
      getMetric in interface Row
    • compareTo

      public int compareTo(Row o)
      Specified by:
      compareTo in interface Comparable<Row>
    • asMap

      public Map<String,Object> asMap()
    • 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