Class MapOfColumnsRowsAndColumns
- java.lang.Object
-
- org.apache.druid.query.rowsandcols.MapOfColumnsRowsAndColumns
-
- All Implemented Interfaces:
RowsAndColumns
public class MapOfColumnsRowsAndColumns extends Object implements RowsAndColumns
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMapOfColumnsRowsAndColumns.Builder
-
Constructor Summary
Constructors Constructor Description MapOfColumnsRowsAndColumns(Map<String,Column> mapOfColumns, int numRows)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tas(Class<T> clazz)Asks the RowsAndColumns to return itself as a concrete implementation of a specific interface.static MapOfColumnsRowsAndColumns.Builderbuilder()ColumnfindColumn(String name)Finds a column by name.static MapOfColumnsRowsAndColumnsfromMap(Map<String,? extends Column> map)static MapOfColumnsRowsAndColumnsfromResultRow(ArrayList<ResultRow> objs, RowSignature signature)static MapOfColumnsRowsAndColumnsfromRowObjects(Object[][] objs, RowSignature signature)Set<String>getColumnNames()The set of column names available from the RowsAndColumnsintnumRows()The number of rows in the RowsAndColumns objectstatic MapOfColumnsRowsAndColumnsof(String name, Column col)static MapOfColumnsRowsAndColumnsof(String name, Column col, String name2, Column col2)
-
-
-
Method Detail
-
builder
public static MapOfColumnsRowsAndColumns.Builder builder()
-
of
public static MapOfColumnsRowsAndColumns of(String name, Column col)
-
of
public static MapOfColumnsRowsAndColumns of(String name, Column col, String name2, Column col2)
-
fromMap
public static MapOfColumnsRowsAndColumns fromMap(Map<String,? extends Column> map)
-
fromResultRow
public static MapOfColumnsRowsAndColumns fromResultRow(ArrayList<ResultRow> objs, RowSignature signature)
-
fromRowObjects
public static MapOfColumnsRowsAndColumns fromRowObjects(Object[][] objs, RowSignature signature)
-
getColumnNames
public Set<String> getColumnNames()
Description copied from interface:RowsAndColumnsThe set of column names available from the RowsAndColumns- Specified by:
getColumnNamesin interfaceRowsAndColumns- Returns:
- The set of column names available from the RowsAndColumns
-
numRows
public int numRows()
Description copied from interface:RowsAndColumnsThe number of rows in the RowsAndColumns object- Specified by:
numRowsin interfaceRowsAndColumns- Returns:
- the integer number of rows
-
findColumn
public Column findColumn(String name)
Description copied from interface:RowsAndColumnsFinds a column by name. null is returned if the column is not found. The RowsAndColumns object should not attempt to default not-found columns to pretend as if they exist, instead the user of the RowsAndColumns object should decide the correct semantic interpretation of a column that does not exist. It is expected that most locations will choose to believe that the column does exist and is always null, but there are often optimizations that can effect this same assumption without doing a lot of extra work if the calling code knows that it does not exist.- Specified by:
findColumnin interfaceRowsAndColumns- Parameters:
name- the name of the column to find- Returns:
- the Column, if found. null if not found.
-
as
public <T> T as(Class<T> clazz)
Description copied from interface:RowsAndColumnsAsks the RowsAndColumns to return itself as a concrete implementation of a specific interface. The interface asked for will tend to be a semantically-meaningful interface. This method allows the calling code to interrogate the RowsAndColumns object about whether it can offer a meaningful optimization of the semantic interface. If a RowsAndColumns cannot do anything specifically optimal for the interface requested, it should return null instead of trying to come up with its own default implementation.- Specified by:
asin interfaceRowsAndColumns- Type Parameters:
T- The interface that the calling code wants a concrete implementation of- Parameters:
clazz- A class object representing the interface that the calling code wants a concrete implementation of- Returns:
- A concrete implementation of the interface, or null if there is no meaningful optimization to be had through a local implementation of the interface.
-
-