public interface Joinable extends ReferenceCountedObject
makeJoinMatcher(org.apache.druid.segment.ColumnSelectorFactory, org.apache.druid.segment.join.JoinConditionAnalysis, boolean, boolean, org.apache.druid.java.util.common.io.Closer)
. Its main user is
HashJoinEngine.makeJoinCursor(org.apache.druid.segment.Cursor, org.apache.druid.segment.join.JoinableClause, boolean, org.apache.druid.java.util.common.io.Closer)
.Modifier and Type | Interface and Description |
---|---|
static class |
Joinable.ColumnValuesWithUniqueFlag |
Modifier and Type | Field and Description |
---|---|
static int |
CARDINALITY_UNKNOWN |
Modifier and Type | Method and Description |
---|---|
List<String> |
getAvailableColumns()
Returns the list of columns that this Joinable offers.
|
int |
getCardinality(String columnName)
Returns the cardinality of "columnName", or
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.
|
Joinable.ColumnValuesWithUniqueFlag |
getNonNullColumnValues(String columnName,
int maxNumValues)
Returns all non-null values from a particular column along with a flag to tell if they are all unique in the column.
|
JoinMatcher |
makeJoinMatcher(ColumnSelectorFactory leftColumnSelectorFactory,
JoinConditionAnalysis condition,
boolean remainderNeeded,
boolean descending,
Closer closer)
Creates a JoinMatcher that can be used to implement a join onto this Joinable.
|
acquireReferences
static final int CARDINALITY_UNKNOWN
List<String> getAvailableColumns()
int getCardinality(String columnName)
CARDINALITY_UNKNOWN
if not known. May be used at query
time to trigger optimizations.
If not 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()
.@Nullable ColumnCapabilities getColumnCapabilities(String columnName)
columnName
- column nameJoinMatcher makeJoinMatcher(ColumnSelectorFactory leftColumnSelectorFactory, JoinConditionAnalysis condition, boolean remainderNeeded, boolean descending, Closer closer)
leftColumnSelectorFactory
- 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.descending
- true if join cursor is iterated in descending ordercloser
- closer that will run after join cursor has completed to clean up any per query
resources the joinable usesJoinable.ColumnValuesWithUniqueFlag getNonNullColumnValues(String columnName, int maxNumValues)
InDimFilter
. For efficiency,
implementations should prefer creating the returned set with
new TreeSet<String>(Comparators.naturalNullsFirst()
}. This avoids a copy in the filter's constructor.columnName
- name of the columnmaxNumValues
- maximum number of values to returnOptional<Set<String>> getCorrelatedColumnValues(String searchColumnName, String searchColumnValue, String retrievalColumnName, long maxCorrelationSetSize, boolean allowNonKeyColumnSearch)
InDimFilter
. For efficiency,
implementations should prefer creating the returned set with
new TreeSet<String>(Comparators.naturalNullsFirst()
}. This avoids a copy in the filter's constructor.searchColumnName
- 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 absent.allowNonKeyColumnSearch
- If true, allow searchs on non-key columns. If this is false,
a search on a non-key column returns absent.Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.