Class RowSignature

java.lang.Object
org.apache.druid.segment.column.RowSignature
All Implemented Interfaces:
Expr.InputBindingInspector, ColumnInspector

public class RowSignature extends Object implements ColumnInspector
Type signature for a row in a Druid datasource or query result.
See Also:
  • Method Details

    • builder

      public static RowSignature.Builder builder()
    • empty

      public static RowSignature empty()
    • getColumnName

      public String getColumnName(int columnNumber)
      Returns the name of the column at position columnNumber.
      Throws:
      IndexOutOfBoundsException - if columnNumber is not within our row length
    • getColumnType

      public Optional<ColumnType> getColumnType(String columnName)
      Returns the type of the column named columnName, or empty if the type is unknown or the column does not exist.
    • getColumnType

      public Optional<ColumnType> getColumnType(int columnNumber)
      Returns the type of the column at position columnNumber, or empty if the type is unknown.
      Throws:
      IndexOutOfBoundsException - if columnNumber is not within our row length
    • isNumeric

      public boolean isNumeric(String columnName)
      Returns true if the column is a numeric type (TypeSignature.isNumeric()), otherwise false if the column is not a numeric type or is not present in the row signature.
    • getColumnNames

      public List<String> getColumnNames()
      Returns a list of column names in the order they appear in this signature.
    • size

      public int size()
      Returns the number of columns in this signature.
    • contains

      public boolean contains(String columnName)
      Returns whether this signature contains a named column.
    • contains

      public boolean contains(int columnNumber)
    • indexOf

      public int indexOf(String columnName)
      Returns the first position of columnName in this row signature, or -1 if it does not appear. Note: the same column name may appear more than once in a signature; if it does, this method will return the first appearance.
    • 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
    • getColumnCapabilities

      @Nullable public ColumnCapabilities getColumnCapabilities(String column)
      Description copied from interface: ColumnInspector
      Returns capabilities of a particular column.
      Specified by:
      getColumnCapabilities in interface ColumnInspector
      Parameters:
      column - column name
      Returns:
      capabilities, or null
    • buildSafeSignature

      public RowSignature buildSafeSignature(List<String> requestedColumnNames)
      Builds a safe RowSignature. The new rowsignature will not contain `null` types - they will be replaced by STRING.
    • getColumnTypes

      public List<ColumnType> getColumnTypes()
      Returns the column types in the order they are in.
    • withPrefix

      public RowSignature withPrefix(String prefix)