Class LookupDataSource

  • All Implemented Interfaces:
    DataSource

    public class LookupDataSource
    extends Object
    implements DataSource
    Represents a lookup.

    Currently, this datasource is not actually queryable, and attempts to do so will lead to errors. It is here as a placeholder for a future time in which it will become queryable.

    The "lookupName" referred to here should be provided by a LookupExtractorFactoryContainerProvider.

    • Constructor Detail

      • LookupDataSource

        public LookupDataSource​(String lookupName)
    • Method Detail

      • 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.
        Specified by:
        getTableNames in interface DataSource
      • getLookupName

        public String getLookupName()
      • getChildren

        public List<DataSource> getChildren()
        Description copied from interface: DataSource
        Returns datasources that this datasource depends on. Will be empty for leaf datasources like 'table'.
        Specified by:
        getChildren in interface DataSource
      • withChildren

        public DataSource withChildren​(List<DataSource> children)
        Description copied from interface: DataSource
        Return a new DataSource, identical to this one, with different children. The number of children must be equal to the number of children that this datasource already has.
        Specified by:
        withChildren in interface DataSource
      • 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.
        Specified by:
        isCacheable in interface DataSource
      • isGlobal

        public boolean isGlobal()
        Description copied from interface: DataSource
        Returns true if all servers have a full copy of this datasource. True for things like inline, lookup, etc, or for queries of those.

        Currently this is coupled with joinability - if this returns true then the query engine expects there exists a JoinableFactory 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.

        Specified by:
        isGlobal in interface DataSource
      • isConcrete

        public boolean isConcrete()
        Description copied from interface: DataSource
        Returns true if this datasource can be the base datasource of query processing. Base datasources drive query processing. If the base datasource is TableDataSource, for example, queries are processed in parallel on data servers. If the base datasource is InlineDataSource, queries are processed on the Broker. See DataSourceAnalysis.getBaseDataSource() for further discussion. Datasources that are *not* concrete must be pre-processed in some way before they can be processed by the main query stack. For example, QueryDataSource must be executed first and substituted with its results.
        Specified by:
        isConcrete in interface DataSource
        See Also:
        which uses this, which uses this
      • withUpdatedDataSource

        public DataSource withUpdatedDataSource​(DataSource newSource)
        Description copied from interface: DataSource
        Returns an updated datasource based on the specified new source.
        Specified by:
        withUpdatedDataSource in interface DataSource
        Parameters:
        newSource - the new datasource to be used to update an existing query
        Returns:
        the updated datasource to be used
      • 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.
        Specified by:
        getCacheKey in interface DataSource
        Returns:
        the cache key to be used as part of query cache key
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object