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 class
RowSignature.Builder
static class
RowSignature.Finalization
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RowSignature.Builder
builder()
boolean
contains(int columnNumber)
boolean
contains(String columnName)
Returns whether this signature contains a named column.static RowSignature
empty()
boolean
equals(Object o)
ColumnCapabilities
getColumnCapabilities(String column)
Returns capabilities of a particular column.String
getColumnName(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.int
hashCode()
int
indexOf(String columnName)
Returns the first position ofcolumnName
in this row signature, or -1 if it does not appear.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.int
size()
Returns the number of columns in this signature.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.druid.segment.ColumnInspector
getColumnCapabilitiesWithDefault, 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 ofcolumnName
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.
-
getColumnCapabilities
@Nullable public ColumnCapabilities getColumnCapabilities(String column)
Description copied from interface:ColumnInspector
Returns capabilities of a particular column.- Specified by:
getColumnCapabilities
in interfaceColumnInspector
- Parameters:
column
- column name- Returns:
- capabilities, or null
-
-