Class ColumnHolderRACColumn
- java.lang.Object
-
- org.apache.druid.query.rowsandcols.concrete.ColumnHolderRACColumn
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Column
public class ColumnHolderRACColumn extends Object implements Column, Closeable
Implements a RowsAndColumns column based on a ColumnHolder. There is a bit of an impedence mis-match between these interfaces in that the ColumnHolder gets at the values of a row by using a BaseColumn which in turn hands off to `ColumnValueSelector` to actually build the thing. The ColumnAccessor from RowsAndColumns, however, believes that it can provide effectively direct access to values.It would be really good to eventually reach down and interact directly with the columns rather than doing this round-about stuff.
This implementation is also very bad with Objects and data types, it masterfully avoids almost every optimization that we have in place. This should also be revisited at some point in time.
-
-
Constructor Summary
Constructors Constructor Description ColumnHolderRACColumn(ColumnHolder holder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
as(Class<? extends T> clazz)
Asks the Column to return itself as a concrete implementation of a specific interface.void
close()
BaseColumn
getBaseColumn()
ColumnAccessor
toAccessor()
Returns the column as aColumnAccessor
.
-
-
-
Constructor Detail
-
ColumnHolderRACColumn
public ColumnHolderRACColumn(ColumnHolder holder)
-
-
Method Detail
-
toAccessor
@Nonnull public ColumnAccessor toAccessor()
Description copied from interface:Column
Returns the column as aColumnAccessor
. Semantically, this would be equivalent to callingColumn.as(ColumnAccessor.class)
. However, being able to implement this interface is part of the explicit contract of implementing this interface, so instead of relying onColumn.as(java.lang.Class<? extends T>)
which allows for returning null, we define a top-level method that should never return null.- Specified by:
toAccessor
in interfaceColumn
- Returns:
- a
ColumnAccessor
representation of the column, this should never return null.
-
as
@Nullable public <T> T as(Class<? extends T> clazz)
Description copied from interface:Column
Asks the Column 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 Column object about whether it can offer a meaningful optimization of the semantic interface. If a Column 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:
as
in interfaceColumn
- 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.
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getBaseColumn
public BaseColumn getBaseColumn()
-
-