|
@@ -6,6 +6,7 @@
|
|
|
|
|
|
package org.elasticsearch.xpack.core.dataframe.transforms.pivot;
|
|
|
|
|
|
+import org.elasticsearch.common.Nullable;
|
|
|
import org.elasticsearch.common.io.stream.StreamInput;
|
|
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
|
|
import org.elasticsearch.common.io.stream.Writeable;
|
|
@@ -35,6 +36,7 @@ public class PivotConfig implements Writeable, ToXContentObject {
|
|
|
private static final String NAME = "data_frame_transform_pivot";
|
|
|
private final GroupConfig groups;
|
|
|
private final AggregationConfig aggregationConfig;
|
|
|
+ private final Integer maxPageSearchSize;
|
|
|
|
|
|
private static final ConstructingObjectParser<PivotConfig, Void> STRICT_PARSER = createParser(false);
|
|
|
private static final ConstructingObjectParser<PivotConfig, Void> LENIENT_PARSER = createParser(true);
|
|
@@ -61,7 +63,7 @@ public class PivotConfig implements Writeable, ToXContentObject {
|
|
|
throw new IllegalArgumentException("Required [aggregations]");
|
|
|
}
|
|
|
|
|
|
- return new PivotConfig(groups, aggregationConfig);
|
|
|
+ return new PivotConfig(groups, aggregationConfig, (Integer)args[3]);
|
|
|
});
|
|
|
|
|
|
parser.declareObject(constructorArg(),
|
|
@@ -69,18 +71,21 @@ public class PivotConfig implements Writeable, ToXContentObject {
|
|
|
|
|
|
parser.declareObject(optionalConstructorArg(), (p, c) -> AggregationConfig.fromXContent(p, lenient), DataFrameField.AGGREGATIONS);
|
|
|
parser.declareObject(optionalConstructorArg(), (p, c) -> AggregationConfig.fromXContent(p, lenient), DataFrameField.AGGS);
|
|
|
+ parser.declareInt(optionalConstructorArg(), DataFrameField.MAX_PAGE_SEARCH_SIZE);
|
|
|
|
|
|
return parser;
|
|
|
}
|
|
|
|
|
|
- public PivotConfig(final GroupConfig groups, final AggregationConfig aggregationConfig) {
|
|
|
+ public PivotConfig(final GroupConfig groups, final AggregationConfig aggregationConfig, Integer maxPageSearchSize) {
|
|
|
this.groups = ExceptionsHelper.requireNonNull(groups, DataFrameField.GROUP_BY.getPreferredName());
|
|
|
this.aggregationConfig = ExceptionsHelper.requireNonNull(aggregationConfig, DataFrameField.AGGREGATIONS.getPreferredName());
|
|
|
+ this.maxPageSearchSize = maxPageSearchSize;
|
|
|
}
|
|
|
|
|
|
public PivotConfig(StreamInput in) throws IOException {
|
|
|
this.groups = new GroupConfig(in);
|
|
|
this.aggregationConfig = new AggregationConfig(in);
|
|
|
+ this.maxPageSearchSize = in.readOptionalInt();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -88,6 +93,9 @@ public class PivotConfig implements Writeable, ToXContentObject {
|
|
|
builder.startObject();
|
|
|
builder.field(DataFrameField.GROUP_BY.getPreferredName(), groups);
|
|
|
builder.field(DataFrameField.AGGREGATIONS.getPreferredName(), aggregationConfig);
|
|
|
+ if (maxPageSearchSize != null) {
|
|
|
+ builder.field(DataFrameField.MAX_PAGE_SEARCH_SIZE.getPreferredName(), maxPageSearchSize);
|
|
|
+ }
|
|
|
builder.endObject();
|
|
|
return builder;
|
|
|
}
|
|
@@ -113,6 +121,7 @@ public class PivotConfig implements Writeable, ToXContentObject {
|
|
|
public void writeTo(StreamOutput out) throws IOException {
|
|
|
groups.writeTo(out);
|
|
|
aggregationConfig.writeTo(out);
|
|
|
+ out.writeOptionalInt(maxPageSearchSize);
|
|
|
}
|
|
|
|
|
|
public AggregationConfig getAggregationConfig() {
|
|
@@ -123,6 +132,11 @@ public class PivotConfig implements Writeable, ToXContentObject {
|
|
|
return groups;
|
|
|
}
|
|
|
|
|
|
+ @Nullable
|
|
|
+ public Integer getMaxPageSearchSize() {
|
|
|
+ return maxPageSearchSize;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public boolean equals(Object other) {
|
|
|
if (this == other) {
|
|
@@ -135,12 +149,14 @@ public class PivotConfig implements Writeable, ToXContentObject {
|
|
|
|
|
|
final PivotConfig that = (PivotConfig) other;
|
|
|
|
|
|
- return Objects.equals(this.groups, that.groups) && Objects.equals(this.aggregationConfig, that.aggregationConfig);
|
|
|
+ return Objects.equals(this.groups, that.groups)
|
|
|
+ && Objects.equals(this.aggregationConfig, that.aggregationConfig)
|
|
|
+ && Objects.equals(this.maxPageSearchSize, that.maxPageSearchSize);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int hashCode() {
|
|
|
- return Objects.hash(groups, aggregationConfig);
|
|
|
+ return Objects.hash(groups, aggregationConfig, maxPageSearchSize);
|
|
|
}
|
|
|
|
|
|
public boolean isValid() {
|