public class InlineDataSource extends Object implements DataSource
The rows are backed by an Iterable, which can be lazy or not. Lazy datasources will only be iterated if someone calls
getRows() and iterates the result, or until someone calls getRowsAsList().
| Modifier and Type | Method and Description |
|---|---|
Function<SegmentReference,SegmentReference> |
createSegmentMapFunction(Query query,
AtomicLong cpuTimeAcc)
Returns a segment function on to how to segment should be modified.
|
boolean |
equals(Object o) |
static InlineDataSource |
fromIterable(Iterable<Object[]> rows,
RowSignature signature)
Creates an inline datasource from an Iterable.
|
byte[] |
getCacheKey()
Compute a cache key prefix for a data source.
|
List<DataSource> |
getChildren()
Returns datasources that this datasource depends on.
|
List<String> |
getColumnNames() |
List<ColumnType> |
getColumnTypes() |
Iterable<Object[]> |
getRows()
Returns rows as an Iterable.
|
List<Object[]> |
getRowsAsList()
Returns rows as a list.
|
RowSignature |
getRowSignature()
Returns the row signature (map of column name to type) for this inline datasource.
|
Set<String> |
getTableNames()
Returns the names of all table datasources involved in this query.
|
int |
hashCode() |
boolean |
isCacheable(boolean isBroker)
Returns true if queries on this dataSource are cacheable at both the result level and per-segment level.
|
boolean |
isConcrete()
Returns true if this datasource represents concrete data that can be scanned via a
Segment adapter of some kind. |
boolean |
isGlobal()
Returns true if all servers have a full copy of this datasource.
|
RowAdapter<Object[]> |
rowAdapter() |
String |
toString() |
DataSource |
withChildren(List<DataSource> children)
Return a new DataSource, identical to this one, with different children.
|
DataSource |
withUpdatedDataSource(DataSource newSource)
Returns an updated datasource based on the specified new source.
|
public static InlineDataSource fromIterable(Iterable<Object[]> rows, RowSignature signature)
getRows() and iterates the result, or until someone calls getRowsAsList().rows - rows, each of the same length as signature.size()signature - row signaturepublic Set<String> getTableNames()
DataSourcegetTableNames in interface DataSource@Nullable public List<ColumnType> getColumnTypes()
public List<Object[]> getRowsAsList()
public List<DataSource> getChildren()
DataSourcegetChildren in interface DataSourcepublic DataSource withChildren(List<DataSource> children)
DataSourcewithChildren in interface DataSourcepublic boolean isCacheable(boolean isBroker)
DataSourceisCacheable in interface DataSourcepublic boolean isGlobal()
DataSourceJoinableFactory which might build a
Joinable for this datasource directly. If a subquery 'inline' join is
required to join this datasource on the right hand side, then this value must be false for now.
In the future, instead of directly using this method, the query planner and engine should consider
JoinableFactory.isDirectlyJoinable(DataSource) when determining if the
right hand side is directly joinable, which would allow decoupling this property from joins.isGlobal in interface DataSourcepublic boolean isConcrete()
DataSourceSegment adapter of some kind. True for e.g. 'table' but not for 'query' or 'join'.isConcrete in interface DataSourcewhich uses this,
which uses thispublic Function<SegmentReference,SegmentReference> createSegmentMapFunction(Query query, AtomicLong cpuTimeAcc)
DataSourcecreateSegmentMapFunction in interface DataSourcequery - the input querycpuTimeAcc - the cpu time accumulatorpublic DataSource withUpdatedDataSource(DataSource newSource)
DataSourcewithUpdatedDataSource in interface DataSourcenewSource - the new datasource to be used to update an existing querypublic byte[] getCacheKey()
DataSourcePreJoinableClause
- NULL - There is a join but caching is not possible. It may happen if one of the participating datasource
in the JOIN is not cacheable.getCacheKey in interface DataSourcepublic RowSignature getRowSignature()
public RowAdapter<Object[]> rowAdapter()
Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.