Class RearrangedRowsAndColumns
java.lang.Object
org.apache.druid.query.rowsandcols.RearrangedRowsAndColumns
- All Implemented Interfaces:
RowsAndColumns
This class exists to "decorate" a rows and columns such that it pretends to exist in a new ordering.
The constructor generally takes an int[] of pointers, these pointers are used to re-map the rows from the
RowsAndColumns object. That is, if the RowsAndColumns has 4 rows and the array new int[]{3, 1, 2, 0}
is passed in, then the order of traverals of the rows will be 3 -> 1 -> 2 -> 0.
This can be useful for sorting potentially immutable data, as the list of pointers can identify the order that the rows should be traversed in. It can also be used for clustering like-data together.
While this avoids a copy, in cases where the data will be iterated regularly, it also generates a random-access pattern that is not always optimal.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.druid.query.rowsandcols.RowsAndColumns
RowsAndColumns.RowsAndColumnsDeserializer, RowsAndColumns.RowsAndColumnsSerializer -
Constructor Summary
ConstructorsConstructorDescriptionRearrangedRowsAndColumns(int[] pointers, int start, int end, RowsAndColumns rac) RearrangedRowsAndColumns(int[] pointers, RowsAndColumns rac) -
Method Summary
Modifier and TypeMethodDescriptionfindColumn(String name) Finds a column by name.The set of column names available from the RowsAndColumnsintnumRows()The number of rows in the RowsAndColumns objectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.query.rowsandcols.RowsAndColumns
as
-
Constructor Details
-
RearrangedRowsAndColumns
-
RearrangedRowsAndColumns
-
-
Method Details
-
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
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.
-