Class JoinableClause

java.lang.Object
org.apache.druid.segment.join.JoinableClause
All Implemented Interfaces:
ReferenceCountedObjectProvider<Closeable>

public class JoinableClause extends Object implements ReferenceCountedObjectProvider<Closeable>
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 Details

  • Method Details

    • 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's JoinMatcher.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.
      See Also:
    • 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 underlying Joinable.getAvailableColumns() method, with our prefix (getPrefix()) prepended.
    • includesColumn

      public boolean includesColumn(String columnName)
      Returns whether "columnName" can be retrieved from the Joinable represented by this clause (i.e., whether it starts with prefix and has at least one other character beyond that).
    • unprefix

      public String unprefix(String columnName)
      Removes our prefix from "columnName". Must only be called if includesColumn(java.lang.String) would have returned true on this column name.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

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

      public Optional<Closeable> acquireReference()
      Description copied from interface: ReferenceCountedObjectProvider
      This method increments a reference count and provides a Closeable that decrements the reference count when closed. The object returned by this method may or may not be thread-safe, it is best to check with the implementation.

      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 ideally avoid allowing this method to throw exceptions, but callers are responsible for closing the returned object should any operations on it throw exceptions.

      For callers: if this method returns non-empty, IT MUST BE CLOSED, else reference counts can potentially leak.

      Specified by:
      acquireReference in interface ReferenceCountedObjectProvider<Closeable>