All Implemented Interfaces:
NamedWriteable, Writeable, PostAnalysisVerificationAware, PostOptimizationVerificationAware, Resolvable, ExecutesOn, SortAgnostic

public class InlineJoin extends Join
Specialized type of join where the source of the left and right plans are the same. The plans themselves can contain different nodes however at the core, both have the same source.

Furthermore, this type of join indicates the right side is performing a subquery identical to the left side - meaning its result is required before joining with the left side.

This helps the model since we want any transformation applied to the source to show up on both sides of the join - due the immutability of the tree (which uses value instead of reference semantics), even if the same node instance would be used, any transformation applied on one side (which would create a new source) would not be reflected on the other side (still use the old source instance). This dedicated instance handles that by replacing the source of the right with a StubRelation that simplifies copies the output of the source, making it easy to serialize/deserialize as well as traversing the plan.

  • Field Details

  • Constructor Details

  • Method Details

    • stubSource

      public static LogicalPlan stubSource(UnaryPlan sourcePlan, LogicalPlan target)
      Replaces the source of the target plan with a stub preserving the output of the source plan.
    • inlineData

      public static LogicalPlan inlineData(InlineJoin target, LocalRelation data)
      TODO: perform better planning Keep the join in place or replace it with an Eval in case no grouping is necessary.
    • replaceStub

      public static LogicalPlan replaceStub(LogicalPlan source, LogicalPlan stubbed)
      Replaces the stubbed source with the actual source. NOTE: this will replace all StubRelations found with the source and the method is meant to be used to replace one node only when being called on a plan that has only ONE StubRelation in it.
    • firstSubPlan

      public static InlineJoin.LogicalPlanTuple firstSubPlan(LogicalPlan optimizedPlan)
      Finds the "first" (closest to the source command or bottom up in the tree) InlineJoin, replaces the StubRelation of the right-hand side with left-hand side's source and returns a tuple. Original optimized plan: Limit[1000[INTEGER],true] \_InlineJoin[LEFT,[],[],[]] |_Limit[1000[INTEGER],false] | \_LocalRelation[[x{r}#99],[IntVectorBlock[vector=ConstantIntVector[positions=1, value=1]]]] \_Aggregate[[],[MAX(x{r}#99,true[BOOLEAN]) AS y#102]] \_StubRelation[[x{r}#99]] Takes the right hand side: Aggregate[[],[MAX(x{r}#99,true[BOOLEAN]) AS y#102]] \_StubRelation[[x{r}#99]]] And uses the left-hand side's source as its source: Aggregate[[],[MAX(x{r}#99,true[BOOLEAN]) AS y#102]] \_Limit[1000[INTEGER],false] \_LocalRelation[[x{r}#99],[IntVectorBlock[vector=ConstantIntVector[positions=1, value=1]]]]
    • getWriteableName

      public String getWriteableName()
      Specified by:
      getWriteableName in interface NamedWriteable
      Overrides:
      getWriteableName in class Join
    • info

      protected NodeInfo<Join> info()
      Overrides:
      info in class Join
    • replaceChildren

      public Join replaceChildren(LogicalPlan left, LogicalPlan right)
      Overrides:
      replaceChildren in class Join
    • computeOutput

      public List<Attribute> computeOutput(List<Attribute> left, List<Attribute> right)
      Overrides:
      computeOutput in class Join