Package org.apache.druid.query
Class InlineDataSource
java.lang.Object
org.apache.druid.query.LeafDataSource
org.apache.druid.query.InlineDataSource
- All Implemented Interfaces:
Cacheable,DataSource
Represents an inline datasource, where the rows are embedded within the DataSource object itself.
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().
-
Field Summary
Fields inherited from interface org.apache.druid.query.DataSource
JOIN_OPERATION_CACHE_ID, NOOP_CACHE_ID, TABLE_DATA_SOURCE_CACHE_ID -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic InlineDataSourcefromIterable(Iterable<Object[]> rows, RowSignature signature) Creates an inline datasource from an Iterable.byte[]Compute a cache key prefix for a data source.getRows()Returns rows as an Iterable.Returns rows as a list.Returns the row signature (map of column name to type) for this inline datasource.Returns the names of all table datasources involved in this query.inthashCode()booleanisCacheable(boolean isBroker) Returns true if queries on this dataSource are cacheable at both the result level and per-segment level.booleanisGlobal()Decides if this datasource can be accessed globally.booleanCommunicates that thisDataSourcecan be directly used to run aQuery.RowAdapter<Object[]>booleantoString()Methods inherited from class org.apache.druid.query.LeafDataSource
createSegmentMapFunction, getChildren, withChildrenMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.druid.query.DataSource
createSegmentPruner, withPolicies
-
Method Details
-
fromIterable
Creates an inline datasource from an Iterable. The Iterable will not be iterated until someone callsgetRows()and iterates the result, or until someone callsgetRowsAsList().- Parameters:
rows- rows, each of the same length assignature.size()signature- row signature
-
getTableNames
Description copied from interface:DataSourceReturns the names of all table datasources involved in this query. Does not include names for non-tables, like lookups or inline datasources. -
getColumnNames
-
getColumnTypes
-
getRowsAsList
Returns rows as a list. If the original Iterable behind this datasource was a List, this method will return it as-is, without copying it. Otherwise, this method will walk the iterable and copy it into a List before returning. -
getRows
Returns rows as an Iterable. -
rowsAreArrayList
public boolean rowsAreArrayList() -
isCacheable
public boolean isCacheable(boolean isBroker) Description copied from interface:DataSourceReturns true if queries on this dataSource are cacheable at both the result level and per-segment level. Currently, dataSources that do not actually reference segments (like 'inline'), are not cacheable since cache keys are always based on segment identifiers. -
isGlobal
public boolean isGlobal()Description copied from interface:DataSourceDecides if this datasource can be accessed globally.This means that all servers have a full copy of this datasource.
Examples: inline table, lookup.
-
isProcessable
public boolean isProcessable()Description copied from interface:DataSourceCommunicates that thisDataSourcecan be directly used to run aQuery.A Processable datasource must pack the necessary logic into the
DataSource.createSegmentMapFunction(Query).Processable examples are:
TableDataSource,InlineDataSource,FilteredDataSource. Non-processable ones are those which need further pre-processing before running them. examples are:QueryDataSourceand join which are not supported directly. -
getCacheKey
public byte[] getCacheKey()Description copied from interface:DataSourceCompute a cache key prefix for a data source. This includes the data sources that participate in the RHS of a join as well as any query specific constructs associated with join data source such as base table filter. This key prefix can be used in segment level cache or result level cache. The function can return following - Non-empty byte array - If there is join datasource involved and caching is possible. The result includes join condition expression, join type and cache key returned by joinable factory for eachPreJoinableClause- 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.- Returns:
- the cache key to be used as part of query cache key
-
getRowSignature
Returns the row signature (map of column name to type) for this inline datasource. Note that types may be null, meaning we know we have a column with a certain name, but we don't know what its type is. -
rowAdapter
-
equals
-
hashCode
public int hashCode() -
toString
-