Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
import org.elasticsearch.xpack.esql.plan.logical.inference.Completion;
import org.elasticsearch.xpack.esql.plan.logical.inference.Rerank;
import org.elasticsearch.xpack.esql.plan.logical.join.InlineJoin;
import org.elasticsearch.xpack.esql.plan.logical.join.Join;
import org.elasticsearch.xpack.esql.plan.logical.join.LookupJoin;
import org.elasticsearch.xpack.esql.plan.logical.join.StubRelation;
import org.elasticsearch.xpack.esql.plan.logical.local.CopyingLocalSupplier;
import org.elasticsearch.xpack.esql.plan.logical.local.LocalRelation;
Expand Down Expand Up @@ -151,8 +151,8 @@ public record QueryProperties(boolean hasGrouping, boolean canDecreaseRowCount,
Grok.class,
InlineJoin.class,
Insist.class,
Join.class,
LocalRelation.class,
LookupJoin.class,
MvExpand.class,
OrderBy.class,
Project.class,
Expand Down Expand Up @@ -499,7 +499,7 @@ private LogicalPlan getLeftmostLeaf(LogicalPlan plan) {
while (plan instanceof LeafPlan == false) {
plan = switch (plan) {
case UnaryPlan unaryPlan -> unaryPlan.child();
case Join join -> join.left();
case LookupJoin join -> join.left();
default -> throw new IllegalStateException("unsupported plan type: " + plan.getClass());
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ protected LogicalPlan rule(Join join) {

List<Alias> renamesForEval = new ArrayList<>(aliasesForReplacedAttributesBuilder.build().values());
Eval eval = new Eval(project.source(), project.child(), renamesForEval);
Join finalJoin = new Join(join.source(), eval, updatedJoin.right(), updatedJoin.config());

return new Project(project.source(), finalJoin, finalProjections);
return new Project(project.source(), updatedJoin.replaceLeft(eval), finalProjections);
}

return join;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.elasticsearch.xpack.esql.core.tree.Source;
import org.elasticsearch.xpack.esql.plan.logical.Limit;
import org.elasticsearch.xpack.esql.plan.logical.LogicalPlan;
import org.elasticsearch.xpack.esql.plan.logical.SurrogateLogicalPlan;

import java.util.List;

Expand All @@ -28,7 +27,7 @@
* Lookup join - specialized LEFT (OUTER) JOIN between the main left side and a lookup index (index_mode = lookup) on the right.
* This is only used during parsing and substituted to a regular {@link Join} during analysis.
*/
public class LookupJoin extends Join implements SurrogateLogicalPlan, TelemetryAware, PostAnalysisVerificationAware {
public class LookupJoin extends Join implements TelemetryAware, PostAnalysisVerificationAware {

public LookupJoin(
Source source,
Expand Down Expand Up @@ -61,15 +60,6 @@ public LookupJoin(Source source, LogicalPlan left, LogicalPlan right, JoinConfig
super(source, left, right, joinConfig, isRemote);
}

/**
* Translate the expression into a regular join with a Projection on top, to deal with serialization &amp; co.
*/
@Override
public LogicalPlan surrogate() {
// TODO: decide whether to introduce USING or just basic ON semantics - keep the ordering out for now
return new Join(source(), left(), right(), config(), isRemote());
}

@Override
public Join replaceChildren(LogicalPlan left, LogicalPlan right) {
return new LookupJoin(source(), left, right, config(), isRemote());
Expand Down