|
@@ -31,7 +31,6 @@ public class FragmentExec extends LeafExec implements EstimatesRowSize {
|
|
|
|
|
|
private final LogicalPlan fragment;
|
|
|
private final QueryBuilder esFilter;
|
|
|
- private final PhysicalPlan reducer; // datanode-level physical plan node that performs an intermediate (not partial) reduce
|
|
|
|
|
|
/**
|
|
|
* Estimate of the number of bytes that'll be loaded per position before
|
|
@@ -40,25 +39,28 @@ public class FragmentExec extends LeafExec implements EstimatesRowSize {
|
|
|
private final int estimatedRowSize;
|
|
|
|
|
|
public FragmentExec(LogicalPlan fragment) {
|
|
|
- this(fragment.source(), fragment, null, 0, null);
|
|
|
+ this(fragment.source(), fragment, null, 0);
|
|
|
}
|
|
|
|
|
|
- public FragmentExec(Source source, LogicalPlan fragment, QueryBuilder esFilter, int estimatedRowSize, PhysicalPlan reducer) {
|
|
|
+ public FragmentExec(Source source, LogicalPlan fragment, QueryBuilder esFilter, int estimatedRowSize) {
|
|
|
super(source);
|
|
|
this.fragment = fragment;
|
|
|
this.esFilter = esFilter;
|
|
|
this.estimatedRowSize = estimatedRowSize;
|
|
|
- this.reducer = reducer;
|
|
|
}
|
|
|
|
|
|
private FragmentExec(StreamInput in) throws IOException {
|
|
|
- this(
|
|
|
- Source.readFrom((PlanStreamInput) in),
|
|
|
- in.readNamedWriteable(LogicalPlan.class),
|
|
|
- in.readOptionalNamedWriteable(QueryBuilder.class),
|
|
|
- in.readOptionalVInt(),
|
|
|
- in.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0) ? in.readOptionalNamedWriteable(PhysicalPlan.class) : null
|
|
|
- );
|
|
|
+ super(Source.readFrom((PlanStreamInput) in));
|
|
|
+ this.fragment = in.readNamedWriteable(LogicalPlan.class);
|
|
|
+ this.esFilter = in.readOptionalNamedWriteable(QueryBuilder.class);
|
|
|
+ if (in.getTransportVersion().onOrAfter(TransportVersions.ESQL_REMOVE_NODE_LEVEL_PLAN)) {
|
|
|
+ this.estimatedRowSize = in.readVInt();
|
|
|
+ } else {
|
|
|
+ this.estimatedRowSize = Objects.requireNonNull(in.readOptionalVInt());
|
|
|
+ if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0)) {
|
|
|
+ in.readOptionalNamedWriteable(PhysicalPlan.class); // for old reducer
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -66,9 +68,13 @@ public class FragmentExec extends LeafExec implements EstimatesRowSize {
|
|
|
Source.EMPTY.writeTo(out);
|
|
|
out.writeNamedWriteable(fragment());
|
|
|
out.writeOptionalNamedWriteable(esFilter());
|
|
|
- out.writeOptionalVInt(estimatedRowSize());
|
|
|
- if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0)) {
|
|
|
- out.writeOptionalNamedWriteable(reducer);
|
|
|
+ if (out.getTransportVersion().onOrAfter(TransportVersions.ESQL_REMOVE_NODE_LEVEL_PLAN)) {
|
|
|
+ out.writeVInt(estimatedRowSize);
|
|
|
+ } else {
|
|
|
+ out.writeOptionalVInt(estimatedRowSize());
|
|
|
+ if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0)) {
|
|
|
+ out.writeOptionalNamedWriteable(null);// for old reducer
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -89,13 +95,9 @@ public class FragmentExec extends LeafExec implements EstimatesRowSize {
|
|
|
return estimatedRowSize;
|
|
|
}
|
|
|
|
|
|
- public PhysicalPlan reducer() {
|
|
|
- return reducer;
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
protected NodeInfo<FragmentExec> info() {
|
|
|
- return NodeInfo.create(this, FragmentExec::new, fragment, esFilter, estimatedRowSize, reducer);
|
|
|
+ return NodeInfo.create(this, FragmentExec::new, fragment, esFilter, estimatedRowSize);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -108,24 +110,20 @@ public class FragmentExec extends LeafExec implements EstimatesRowSize {
|
|
|
int estimatedRowSize = state.consumeAllFields(false);
|
|
|
return Objects.equals(estimatedRowSize, this.estimatedRowSize)
|
|
|
? this
|
|
|
- : new FragmentExec(source(), fragment, esFilter, estimatedRowSize, reducer);
|
|
|
+ : new FragmentExec(source(), fragment, esFilter, estimatedRowSize);
|
|
|
}
|
|
|
|
|
|
public FragmentExec withFragment(LogicalPlan fragment) {
|
|
|
- return Objects.equals(fragment, this.fragment) ? this : new FragmentExec(source(), fragment, esFilter, estimatedRowSize, reducer);
|
|
|
+ return Objects.equals(fragment, this.fragment) ? this : new FragmentExec(source(), fragment, esFilter, estimatedRowSize);
|
|
|
}
|
|
|
|
|
|
public FragmentExec withFilter(QueryBuilder filter) {
|
|
|
- return Objects.equals(filter, this.esFilter) ? this : new FragmentExec(source(), fragment, filter, estimatedRowSize, reducer);
|
|
|
- }
|
|
|
-
|
|
|
- public FragmentExec withReducer(PhysicalPlan reducer) {
|
|
|
- return Objects.equals(reducer, this.reducer) ? this : new FragmentExec(source(), fragment, esFilter, estimatedRowSize, reducer);
|
|
|
+ return Objects.equals(filter, this.esFilter) ? this : new FragmentExec(source(), fragment, filter, estimatedRowSize);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int hashCode() {
|
|
|
- return Objects.hash(fragment, esFilter, estimatedRowSize, reducer);
|
|
|
+ return Objects.hash(fragment, esFilter, estimatedRowSize);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -141,8 +139,7 @@ public class FragmentExec extends LeafExec implements EstimatesRowSize {
|
|
|
FragmentExec other = (FragmentExec) obj;
|
|
|
return Objects.equals(fragment, other.fragment)
|
|
|
&& Objects.equals(esFilter, other.esFilter)
|
|
|
- && Objects.equals(estimatedRowSize, other.estimatedRowSize)
|
|
|
- && Objects.equals(reducer, other.reducer);
|
|
|
+ && Objects.equals(estimatedRowSize, other.estimatedRowSize);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -154,7 +151,6 @@ public class FragmentExec extends LeafExec implements EstimatesRowSize {
|
|
|
sb.append(", estimatedRowSize=");
|
|
|
sb.append(estimatedRowSize);
|
|
|
sb.append(", reducer=[");
|
|
|
- sb.append(reducer == null ? "" : reducer.toString());
|
|
|
sb.append("], fragment=[<>\n");
|
|
|
sb.append(fragment.toString());
|
|
|
sb.append("<>]]");
|