public class LookupJoinable extends Object implements Joinable
CARDINALITY_UNKNOWN| Modifier and Type | Method and Description |
|---|---|
Optional<Closeable> |
acquireReferences()
This method is expected to increment a reference count and provide a
Closeable that decrements the
reference count when closed. |
List<String> |
getAvailableColumns()
Returns the list of columns that this Joinable offers.
|
int |
getCardinality(String columnName)
Returns the cardinality of "columnName", or
Joinable.CARDINALITY_UNKNOWN if not known. |
ColumnCapabilities |
getColumnCapabilities(String columnName)
Returns capabilities for one of this Joinable's columns.
|
Optional<Set<String>> |
getCorrelatedColumnValues(String searchColumnName,
String searchColumnValue,
String retrievalColumnName,
long maxCorrelationSetSize,
boolean allowNonKeyColumnSearch)
Searches a column from this Joinable for a particular value, finds rows that match,
and returns values of a second column for those rows.
|
JoinMatcher |
makeJoinMatcher(ColumnSelectorFactory leftSelectorFactory,
JoinConditionAnalysis condition,
boolean remainderNeeded)
Creates a JoinMatcher that can be used to implement a join onto this Joinable.
|
static LookupJoinable |
wrap(LookupExtractor extractor) |
public static LookupJoinable wrap(LookupExtractor extractor)
public List<String> getAvailableColumns()
JoinablegetAvailableColumns in interface Joinablepublic int getCardinality(String columnName)
JoinableJoinable.CARDINALITY_UNKNOWN if not known. May be used at query
time to trigger optimizations.
If not Joinable.CARDINALITY_UNKNOWN, this must match the cardinality of selectors returned by the
ColumnSelectorFactory.makeDimensionSelector(org.apache.druid.query.dimension.DimensionSpec) method of this joinable's
JoinMatcher.getColumnSelectorFactory() .getCardinality in interface Joinable@Nullable public ColumnCapabilities getColumnCapabilities(String columnName)
JoinablegetColumnCapabilities in interface JoinablecolumnName - column namepublic JoinMatcher makeJoinMatcher(ColumnSelectorFactory leftSelectorFactory, JoinConditionAnalysis condition, boolean remainderNeeded)
JoinablemakeJoinMatcher in interface JoinableleftSelectorFactory - column selector factory that allows access to the left-hand side of the joincondition - join condition for the matcherremainderNeeded - whether or not JoinMatcher.matchRemainder() will ever be called on the
matcher. If we know it will not, additional optimizations are often possible.public Optional<Set<String>> getCorrelatedColumnValues(String searchColumnName, String searchColumnValue, String retrievalColumnName, long maxCorrelationSetSize, boolean allowNonKeyColumnSearch)
JoinablegetCorrelatedColumnValues in interface JoinablesearchColumnName - Name of the search column. This is the column that is being used in the filtersearchColumnValue - Target value of the search column. This is the value that is being filtered on.retrievalColumnName - The column to retrieve values from. This is the column that is being joined against.maxCorrelationSetSize - Maximum number of values to retrieve. If we detect that more values would be
returned than this limit, return an empty set.allowNonKeyColumnSearch - If true, allow searchs on non-key columns. If this is false,
a search on a non-key column should return an empty set.public Optional<Closeable> acquireReferences()
ReferenceCountedObjectCloseable that decrements the
reference count when closed. This is likely just a wrapper around
ReferenceCountingCloseableObject.incrementReferenceAndDecrementOnceCloseable(), but may also include any
other associated references which should be incremented when this method is called, and decremented/released by the
closeable.
IMPORTANT NOTE: to fulfill the contract of this method, implementors must return a closeable to indicate that the
reference can be acquired, even if there is nothing to close. Implementors should avoid allowing this method or the
Closeable it creates to throw exceptions.
For callers: if this method returns non-empty, IT MUST BE CLOSED, else reference counts can potentially leak.acquireReferences in interface ReferenceCountedObjectCopyright © 2011–2020 The Apache Software Foundation. All rights reserved.