Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -10,15 +10,12 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.xpack.esql.capabilities.TelemetryAware;
import org.elasticsearch.xpack.esql.core.expression.Attribute;
import org.elasticsearch.xpack.esql.core.expression.AttributeSet;
import org.elasticsearch.xpack.esql.core.expression.Expression;
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
import org.elasticsearch.xpack.esql.core.tree.Source;
import org.elasticsearch.xpack.esql.io.stream.PlanStreamInput;

import java.io.IOException;
import java.util.List;
import java.util.Objects;

public class Limit extends UnaryPlan implements TelemetryAware {
Expand Down Expand Up @@ -78,16 +75,6 @@ public String getWriteableName() {
return ENTRY.name;
}

@Override
public List<Attribute> output() {
return child().output();
}

@Override
public AttributeSet outputSet() {
return child().outputSet();
}

@Override
protected NodeInfo<Limit> info() {
return NodeInfo.create(this, Limit::new, limit, child(), duplicated);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import org.elasticsearch.xpack.esql.capabilities.TelemetryAware;
import org.elasticsearch.xpack.esql.common.Failures;
import org.elasticsearch.xpack.esql.core.capabilities.Resolvables;
import org.elasticsearch.xpack.esql.core.expression.Attribute;
import org.elasticsearch.xpack.esql.core.expression.AttributeSet;
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
import org.elasticsearch.xpack.esql.core.tree.Source;
import org.elasticsearch.xpack.esql.core.type.DataType;
Expand Down Expand Up @@ -63,16 +61,6 @@ public String getWriteableName() {
return ENTRY.name;
}

@Override
public List<Attribute> output() {
return child().output();
}

@Override
public AttributeSet outputSet() {
return child().outputSet();
}

@Override
protected NodeInfo<OrderBy> info() {
return NodeInfo.create(this, OrderBy::new, child(), order);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.xpack.esql.core.capabilities.Resolvables;
import org.elasticsearch.xpack.esql.core.expression.Attribute;
import org.elasticsearch.xpack.esql.core.expression.AttributeSet;
import org.elasticsearch.xpack.esql.core.expression.Expression;
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
import org.elasticsearch.xpack.esql.core.tree.Source;
Expand Down Expand Up @@ -57,16 +55,6 @@ public String getWriteableName() {
return ENTRY.name;
}

@Override
public List<Attribute> output() {
return child().output();
}

@Override
public AttributeSet outputSet() {
return child().outputSet();
}

@Override
public boolean expressionsResolved() {
return limit.resolved() && Resolvables.resolved(order);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
public abstract class UnaryPlan extends LogicalPlan {

private final LogicalPlan child;
private AttributeSet lazyOutputSet;

protected UnaryPlan(Source source, LogicalPlan child) {
super(source, Collections.singletonList(child));
Expand All @@ -43,9 +44,12 @@ public List<Attribute> output() {
return child.output();
}

@Override
public AttributeSet outputSet() {
return child().outputSet();
if (lazyOutputSet == null) {
List<Attribute> output = output();
lazyOutputSet = (output == child.output() ? child.outputSet() : new AttributeSet(output));
}
return lazyOutputSet;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.xpack.esql.core.expression.Attribute;
import org.elasticsearch.xpack.esql.core.expression.AttributeSet;
import org.elasticsearch.xpack.esql.core.expression.Expression;
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
import org.elasticsearch.xpack.esql.core.tree.Source;
Expand Down Expand Up @@ -69,11 +68,6 @@ public List<Attribute> output() {
return child().output();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope, but I noticed this is redundant.


@Override
public AttributeSet outputSet() {
return child().outputSet();
}

@Override
public int hashCode() {
return Objects.hash(condition, child());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.xpack.esql.core.expression.Attribute;
import org.elasticsearch.xpack.esql.core.expression.AttributeSet;
import org.elasticsearch.xpack.esql.core.expression.Expression;
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
import org.elasticsearch.xpack.esql.core.tree.Source;
import org.elasticsearch.xpack.esql.io.stream.PlanStreamInput;

import java.io.IOException;
import java.util.List;
import java.util.Objects;

public class LimitExec extends UnaryExec {
Expand Down Expand Up @@ -51,16 +48,6 @@ public String getWriteableName() {
return ENTRY.name;
}

@Override
public List<Attribute> output() {
return child().output();
}

@Override
public AttributeSet outputSet() {
return child().outputSet();
}

@Override
protected NodeInfo<? extends LimitExec> info() {
return NodeInfo.create(this, LimitExec::new, child(), limit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.xpack.esql.core.expression.Attribute;
import org.elasticsearch.xpack.esql.core.expression.AttributeSet;
import org.elasticsearch.xpack.esql.core.expression.Expression;
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
import org.elasticsearch.xpack.esql.core.tree.Source;
Expand Down Expand Up @@ -70,16 +69,6 @@ public String getWriteableName() {
return ENTRY.name;
}

@Override
public List<Attribute> output() {
return child().output();
}

@Override
public AttributeSet outputSet() {
return child().outputSet();
}

@Override
protected NodeInfo<TopNExec> info() {
return NodeInfo.create(this, TopNExec::new, child(), order, limit, estimatedRowSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package org.elasticsearch.xpack.esql.plan.physical;

import org.elasticsearch.xpack.esql.core.expression.Attribute;
import org.elasticsearch.xpack.esql.core.expression.AttributeSet;
import org.elasticsearch.xpack.esql.core.tree.Source;

import java.util.Collections;
Expand All @@ -17,6 +18,7 @@
public abstract class UnaryExec extends PhysicalPlan {

private final PhysicalPlan child;
private AttributeSet lazyOutputSet;

protected UnaryExec(Source source, PhysicalPlan child) {
super(source, Collections.singletonList(child));
Expand All @@ -39,6 +41,16 @@ public List<Attribute> output() {
return child.output();
}

@Override
public AttributeSet outputSet() {
if (lazyOutputSet == null) {
List<Attribute> output = output();
lazyOutputSet = (output == child.output() ? child.outputSet() : new AttributeSet(output));
return lazyOutputSet;
}
return lazyOutputSet;
}

@Override
public int hashCode() {
return Objects.hashCode(child());
Expand Down