Package org.apache.druid.segment.join
Class JoinableClause
- java.lang.Object
-
- org.apache.druid.segment.join.JoinableClause
-
- All Implemented Interfaces:
ReferenceCountedObject
public class JoinableClause extends Object implements ReferenceCountedObject
Represents everything about a join clause except for the left-hand datasource. In other words, if the full join clause is "t1 JOIN t2 ON t1.x = t2.x" then this class represents "JOIN t2 ON x = t2.x" -- it does not include references to the left-hand "t1".Created from
PreJoinableClause
.
-
-
Constructor Summary
Constructors Constructor Description JoinableClause(String prefix, Joinable joinable, JoinType joinType, JoinConditionAnalysis condition)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Closeable>
acquireReferences()
This method is expected to increment a reference count and provide aCloseable
that decrements the reference count when closed.boolean
equals(Object o)
List<String>
getAvailableColumnsPrefixed()
Returns a list of columns from the underlyingJoinable.getAvailableColumns()
method, with our prefix (getPrefix()
) prepended.JoinConditionAnalysis
getCondition()
The join condition.Joinable
getJoinable()
The right-hand Joinable.JoinType
getJoinType()
The type of join: LEFT, RIGHT, INNER, or FULL.String
getPrefix()
The prefix to apply to all columns from the Joinable.int
hashCode()
boolean
includesColumn(String columnName)
Returns whether "columnName" can be retrieved from theJoinable
represented by this clause (i.e., whether it starts withprefix
and has at least one other character beyond that).String
toString()
String
unprefix(String columnName)
Removes our prefix from "columnName".
-
-
-
Constructor Detail
-
JoinableClause
public JoinableClause(String prefix, Joinable joinable, JoinType joinType, JoinConditionAnalysis condition)
-
-
Method Detail
-
getPrefix
public String getPrefix()
The prefix to apply to all columns from the Joinable. The idea is that during a join, any columns that start with this prefix should be retrieved from our Joinable'sJoinMatcher.getColumnSelectorFactory()
. Any other columns should be returned from the left-hand side of the join. The prefix can be any string, as long as it is nonempty and not itself a prefix of the reserved column name__time
.
-
getJoinable
public Joinable getJoinable()
The right-hand Joinable.
-
getJoinType
public JoinType getJoinType()
The type of join: LEFT, RIGHT, INNER, or FULL.
-
getCondition
public JoinConditionAnalysis getCondition()
The join condition. When referring to right-hand columns, it should include the prefix.
-
getAvailableColumnsPrefixed
public List<String> getAvailableColumnsPrefixed()
Returns a list of columns from the underlyingJoinable.getAvailableColumns()
method, with our prefix (getPrefix()
) prepended.
-
includesColumn
public boolean includesColumn(String columnName)
Returns whether "columnName" can be retrieved from theJoinable
represented by this clause (i.e., whether it starts withprefix
and has at least one other character beyond that).
-
unprefix
public String unprefix(String columnName)
Removes our prefix from "columnName". Must only be called ifincludesColumn(java.lang.String)
would have returned true on this column name.
-
acquireReferences
public Optional<Closeable> acquireReferences()
Description copied from interface:ReferenceCountedObject
This method is expected to increment a reference count and provide aCloseable
that decrements the reference count when closed. This is likely just a wrapper aroundReferenceCountingCloseableObject.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 theCloseable
it creates to throw exceptions. For callers: if this method returns non-empty, IT MUST BE CLOSED, else reference counts can potentially leak.- Specified by:
acquireReferences
in interfaceReferenceCountedObject
-
-