Class TableDataSource

java.lang.Object
org.apache.druid.query.LeafDataSource
org.apache.druid.query.TableDataSource
All Implemented Interfaces:
Cacheable, DataSource
Direct Known Subclasses:
GlobalTableDataSource

public class TableDataSource extends LeafDataSource
  • Constructor Details

    • TableDataSource

      public TableDataSource(String name)
  • Method Details

    • create

      public static TableDataSource create(String name)
    • getName

      public String getName()
    • getTableNames

      public Set<String> getTableNames()
      Description copied from interface: DataSource
      Returns the names of all table datasources involved in this query. Does not include names for non-tables, like lookups or inline datasources.
    • isCacheable

      public boolean isCacheable(boolean isBroker)
      Description copied from interface: DataSource
      Returns 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: DataSource
      Decides 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: DataSource
      Communicates that this DataSource can be directly used to run a Query.

      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: QueryDataSource and join which are not supported directly.

    • withPolicies

      public DataSource withPolicies(Map<String,Optional<Policy>> policyMap, PolicyEnforcer policyEnforcer)
      Description copied from interface: DataSource
      Returns an updated datasource based on the policy restrictions on tables.

      If this datasource contains no table, no changes should occur.

      Parameters:
      policyMap - a mapping of table names to policy restrictions. A missing key is different from an empty value:
      • a missing key means the table has never been permission checked.
      • an empty value indicates the table doesn't have any policy restrictions, it has been permission checked.
      policyEnforcer - the policy enforcer to enforce the result datasource complies
      Returns:
      the updated datasource, with restrictions applied in the datasource tree
    • getCacheKey

      public byte[] getCacheKey()
      Description copied from interface: DataSource
      Compute 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 each PreJoinableClause - 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
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object