Skip to content

Commit 7da65f8

Browse files
author
elasticsearchmachine
committed
[CI] Auto commit changes from spotless
1 parent 320b2c6 commit 7da65f8

File tree

10 files changed

+60
-24
lines changed

10 files changed

+60
-24
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/ChangePointOperator.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ public class ChangePointOperator implements Operator {
3737

3838
public static final int INPUT_VALUE_COUNT_LIMIT = 1000;
3939

40-
public record Factory(int metricChannel, Optional<Integer> partitionChannel, String sourceText, int sourceLine, int sourceColumn) implements OperatorFactory {
40+
public record Factory(int metricChannel, Optional<Integer> partitionChannel, String sourceText, int sourceLine, int sourceColumn)
41+
implements
42+
OperatorFactory {
4143
@Override
4244
public Operator get(DriverContext driverContext) {
4345
return new ChangePointOperator(driverContext, metricChannel, partitionChannel, sourceText, sourceLine, sourceColumn);
@@ -63,7 +65,14 @@ public String describe() {
6365

6466
// TODO: make org.elasticsearch.xpack.esql.core.tree.Source available here
6567
// (by modularizing esql-core) and use that instead of the individual fields.
66-
public ChangePointOperator(DriverContext driverContext, int metricChannel, Optional<Integer> partitionChannel, String sourceText, int sourceLine, int sourceColumn) {
68+
public ChangePointOperator(
69+
DriverContext driverContext,
70+
int metricChannel,
71+
Optional<Integer> partitionChannel,
72+
String sourceText,
73+
int sourceLine,
74+
int sourceColumn
75+
) {
6776
this.driverContext = driverContext;
6877
this.metricChannel = metricChannel;
6978
this.partitionChannel = partitionChannel;
@@ -230,7 +239,8 @@ private void insertChangePoints(Iterable<ChangeType> changeTypes) {
230239
lastPartitionFieldValue = currentPartitionFieldValue;
231240

232241
try {
233-
if (pageStartIndex <= changeType.changePoint() && changeType.changePoint() < pageStartIndex + inputPage.getPositionCount()) {
242+
if (pageStartIndex <= changeType.changePoint()
243+
&& changeType.changePoint() < pageStartIndex + inputPage.getPositionCount()) {
234244
try (
235245
BytesRefBlock.Builder changeTypeBlockBuilder = blockFactory.newBytesRefBlockBuilder(inputPage.getPositionCount());
236246
DoubleBlock.Builder pvalueBlockBuilder = blockFactory.newDoubleBlockBuilder(inputPage.getPositionCount())
@@ -294,7 +304,10 @@ public String toString() {
294304
}
295305

296306
private static String describe(int metricChannel, Optional<Integer> partitionChannel) {
297-
return "ChangePointOperator[metricChannel=" + metricChannel + (partitionChannel.isPresent() ? ", partitionChannel=" + partitionChannel.get() : "") + "]";
307+
return "ChangePointOperator[metricChannel="
308+
+ metricChannel
309+
+ (partitionChannel.isPresent() ? ", partitionChannel=" + partitionChannel.get() : "")
310+
+ "]";
298311
}
299312

300313
private Warnings warnings(boolean onlyWarnings) {

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ChangePointByOperatorTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class ChangePointByOperatorTests extends OperatorTestCase {
3030
@Override
3131
protected SourceOperator simpleInput(BlockFactory blockFactory, int size) {
3232
// size must be in [25, 1000] for ChangePoint to function correctly and detect the step change.
33-
size = 25;//Math.clamp(size, 25, 1000);
33+
size = 25;// Math.clamp(size, 25, 1000);
3434
List<Tuple<Long, BytesRef>> data = new ArrayList<>(size);
3535
for (int i = 0; i < size; i++) { // step change 0 -> 100
3636
data.add(Tuple.tuple(i < size / 2 ? randomLongBetween(0, 3) : randomLongBetween(100, 103), new BytesRef("prod")));
@@ -81,7 +81,7 @@ protected void assertSimpleOutput(List<Page> input, List<Page> output) {
8181

8282
@Override
8383
protected Operator.OperatorFactory simple() {
84-
return new ChangePointOperator.Factory(0, Optional.of(1), null,0, 0);
84+
return new ChangePointOperator.Factory(0, Optional.of(1), null, 0, 0);
8585
}
8686

8787
@Override

x-pack/plugin/esql/compute/test/src/main/java/org/elasticsearch/compute/test/AbstractBlockSourceOperator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.elasticsearch.compute.data.BlockFactory;
1111
import org.elasticsearch.compute.data.Page;
1212
import org.elasticsearch.compute.operator.SourceOperator;
13-
import org.elasticsearch.test.ESTestCase;
1413

1514
/**
1615
* An abstract source operator. Implementations of this operator produce pages with a random

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/LogicalPlanBuilder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,9 @@ public PlanFactory visitChangePointCommand(EsqlBaseParser.ChangePointCommandCont
479479
Source src = source(ctx);
480480
Attribute value = visitQualifiedName(ctx.value);
481481
Attribute key = ctx.key == null ? new UnresolvedAttribute(src, "@timestamp") : visitQualifiedName(ctx.key);
482-
Attribute partitionField = ctx.partitionField == null ? new UnresolvedAttribute(src, "partition") : visitQualifiedName(ctx.partitionField);
482+
Attribute partitionField = ctx.partitionField == null
483+
? new UnresolvedAttribute(src, "partition")
484+
: visitQualifiedName(ctx.partitionField);
483485
Attribute targetType = new ReferenceAttribute(
484486
src,
485487
ctx.targetType == null ? "type" : visitQualifiedName(ctx.targetType).name(),

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/logical/ChangePoint.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,15 @@ public class ChangePoint extends UnaryPlan implements SurrogateLogicalPlan, Post
5151

5252
private List<Attribute> output;
5353

54-
public ChangePoint(Source source, LogicalPlan child, Attribute value, Attribute key, Attribute partitionField, Attribute targetType, Attribute targetPvalue) {
54+
public ChangePoint(
55+
Source source,
56+
LogicalPlan child,
57+
Attribute value,
58+
Attribute key,
59+
Attribute partitionField,
60+
Attribute targetType,
61+
Attribute targetPvalue
62+
) {
5563
super(source, child);
5664
this.value = value;
5765
this.key = key;
@@ -141,26 +149,26 @@ private Order order() {
141149
public LogicalPlan surrogate() {
142150
Order keyOrder = order();
143151

144-
// // The first Limit of N+1 data points is necessary to generate a possible warning,
145-
// Limit limit = new Limit(
146-
// source(),
147-
// new Literal(Source.EMPTY, ChangePointOperator.INPUT_VALUE_COUNT_LIMIT + 1, DataType.INTEGER),
148-
// orderBy
149-
// );
152+
// // The first Limit of N+1 data points is necessary to generate a possible warning,
153+
// Limit limit = new Limit(
154+
// source(),
155+
// new Literal(Source.EMPTY, ChangePointOperator.INPUT_VALUE_COUNT_LIMIT + 1, DataType.INTEGER),
156+
// orderBy
157+
// );
150158

151159
TopN topN = new TopN(
152160
source(),
153161
child(),
154-
null,//partitionField,
162+
null,// partitionField,
155163
List.of(keyOrder),
156164
new Literal(Source.EMPTY, ChangePointOperator.INPUT_VALUE_COUNT_LIMIT, DataType.INTEGER)
157165
);
158166

159-
160167
ChangePoint changePoint = new ChangePoint(source(), topN, value, key, partitionField, targetType, targetPvalue);
161168
return changePoint;
162-
// // The second Limit of N data points is to truncate the output.
163-
// return new Limit(source(), new Literal(Source.EMPTY, ChangePointOperator.INPUT_VALUE_COUNT_LIMIT, DataType.INTEGER), changePoint);
169+
// // The second Limit of N data points is to truncate the output.
170+
// return new Limit(source(), new Literal(Source.EMPTY, ChangePointOperator.INPUT_VALUE_COUNT_LIMIT, DataType.INTEGER),
171+
// changePoint);
164172
}
165173

166174
@Override

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/logical/TopN.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.elasticsearch.common.io.stream.StreamInput;
1212
import org.elasticsearch.common.io.stream.StreamOutput;
1313
import org.elasticsearch.xpack.esql.core.capabilities.Resolvables;
14-
import org.elasticsearch.xpack.esql.core.expression.Attribute;
1514
import org.elasticsearch.xpack.esql.core.expression.Expression;
1615
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
1716
import org.elasticsearch.xpack.esql.core.tree.Source;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/physical/TopNExec.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ public class TopNExec extends UnaryExec implements EstimatesRowSize {
3939
*/
4040
private final Integer estimatedRowSize;
4141

42-
public TopNExec(Source source, PhysicalPlan child, Expression partitionField, List<Order> order, Expression limit, Integer estimatedRowSize) {
42+
public TopNExec(
43+
Source source,
44+
PhysicalPlan child,
45+
Expression partitionField,
46+
List<Order> order,
47+
Expression limit,
48+
Integer estimatedRowSize
49+
) {
4350
super(source, child);
4451
this.partitionField = partitionField;
4552
this.order = order;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/LocalExecutionPlanner.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,9 @@ private PhysicalOperation planChangePoint(ChangePointExec changePoint, LocalExec
815815
return source.with(
816816
new ChangePointOperator.Factory(
817817
layout.get(changePoint.value().id()).channel(),
818-
changePoint.partitionField().typeResolved().resolved() ? Optional.of(layout.get(changePoint.partitionField().id()).channel()) : Optional.empty(),
818+
changePoint.partitionField().typeResolved().resolved()
819+
? Optional.of(layout.get(changePoint.partitionField().id()).channel())
820+
: Optional.empty(),
819821
changePoint.sourceText(),
820822
changePoint.sourceLocation().getLineNumber(),
821823
changePoint.sourceLocation().getColumnNumber()

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/plan/logical/TopNSerializationTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ protected TopN mutateInstance(TopN instance) throws IOException {
4646
Expression limit = instance.limit();
4747
switch (between(0, 3)) {
4848
case 0 -> child = randomValueOtherThan(child, () -> randomChild(0));
49-
case 1 -> partitionField = randomValueOtherThan(partitionField, () -> new Literal(randomSource(), randomAlphaOfLengthBetween(1, 10), DataType.KEYWORD));
49+
case 1 -> partitionField = randomValueOtherThan(
50+
partitionField,
51+
() -> new Literal(randomSource(), randomAlphaOfLengthBetween(1, 10), DataType.KEYWORD)
52+
);
5053
case 2 -> order = randomValueOtherThan(order, TopNSerializationTests::randomOrders);
5154
case 3 -> limit = randomValueOtherThan(limit, AbstractExpressionSerializationTests::randomChild);
5255
}

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/plan/physical/TopNExecSerializationTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ protected TopNExec mutateInstance(TopNExec instance) throws IOException {
4848
estimatedRowSize,
4949
AbstractPhysicalPlanSerializationTests::randomEstimatedRowSize
5050
);
51-
case 4 -> partitionField = randomValueOtherThan(partitionField, () -> new Literal(randomSource(), randomAlphaOfLengthBetween(1, 10), DataType.KEYWORD));
51+
case 4 -> partitionField = randomValueOtherThan(
52+
partitionField,
53+
() -> new Literal(randomSource(), randomAlphaOfLengthBetween(1, 10), DataType.KEYWORD)
54+
);
5255
default -> throw new UnsupportedOperationException();
5356
}
5457
return new TopNExec(instance.source(), child, partitionField, order, limit, estimatedRowSize);

0 commit comments

Comments
 (0)