Package org.apache.druid.segment.column
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRowSignature.Builderstatic classRowSignature.Finalization
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RowSignature.Builderbuilder()RowSignaturebuildSafeSignature(com.google.common.collect.ImmutableList<String> requestedColumnNames)Builds a safeRowSignature.booleancontains(int columnNumber)booleancontains(String columnName)Returns whether this signature contains a named column.static RowSignatureempty()booleanequals(Object o)ColumnCapabilitiesgetColumnCapabilities(String column)Returns capabilities of a particular column.StringgetColumnName(int columnNumber)Returns the name of the column at positioncolumnNumber.List<String>getColumnNames()Returns a list of column names in the order they appear in this signature.Optional<ColumnType>getColumnType(int columnNumber)Returns the type of the column at positioncolumnNumber, or empty if the type is unknown.Optional<ColumnType>getColumnType(String columnName)Returns the type of the column namedcolumnName, or empty if the type is unknown or the column does not exist.List<ColumnType>getColumnTypes()Returns the column types in the order they are in.inthashCode()intindexOf(String columnName)Returns the first position ofcolumnNamein this row signature, or -1 if it does not appear.booleanisNumeric(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.intsize()Returns the number of columns in this signature.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.druid.segment.ColumnInspector
getType
-
Methods inherited from interface org.apache.druid.math.expr.Expr.InputBindingInspector
areNumeric, areNumeric, areSameTypes, areSameTypes, areScalar, areScalar, canVectorize, canVectorize
-
-
-
-
Method Detail
-
builder
public static RowSignature.Builder builder()
-
empty
public static RowSignature empty()
-
getColumnName
public String getColumnName(int columnNumber)
Returns the name of the column at positioncolumnNumber.- Throws:
IndexOutOfBoundsException- if columnNumber is not within our row length
-
getColumnType
public Optional<ColumnType> getColumnType(String columnName)
Returns the type of the column namedcolumnName, 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 positioncolumnNumber, 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 ofcolumnNamein 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.
-
getColumnCapabilities
@Nullable public ColumnCapabilities getColumnCapabilities(String column)
Description copied from interface:ColumnInspectorReturns capabilities of a particular column.- Specified by:
getColumnCapabilitiesin interfaceColumnInspector- Parameters:
column- column name- Returns:
- capabilities, or null
-
buildSafeSignature
public RowSignature buildSafeSignature(com.google.common.collect.ImmutableList<String> requestedColumnNames)
Builds a safeRowSignature. 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.
-
-