|
28 | 28 | import org.elasticsearch.xpack.esql.expression.promql.predicate.operator.comparison.VectorBinaryComparison.ComparisonOp; |
29 | 29 | import org.elasticsearch.xpack.esql.expression.promql.predicate.operator.set.VectorBinarySet; |
30 | 30 | import org.elasticsearch.xpack.esql.expression.promql.subquery.Subquery; |
31 | | -import org.elasticsearch.xpack.esql.parser.EsqlBaseParser; |
32 | 31 | import org.elasticsearch.xpack.esql.parser.ParsingException; |
33 | 32 | import org.elasticsearch.xpack.esql.parser.PromqlBaseParser; |
34 | 33 | import org.elasticsearch.xpack.esql.plan.logical.LogicalPlan; |
@@ -296,7 +295,7 @@ public LogicalPlan visitArithmeticBinary(PromqlBaseParser.ArithmeticBinaryContex |
296 | 295 | Object leftValue = leftLiteral.value(); |
297 | 296 | Object rightValue = rightLiteral.value(); |
298 | 297 |
|
299 | | - // arithmetics |
| 298 | + // arithmetics |
300 | 299 | if (binaryOperator instanceof ArithmeticOp arithmeticOp) { |
301 | 300 | Object result = PromqlFoldingUtils.evaluate(source, leftValue, rightValue, arithmeticOp); |
302 | 301 | DataType resultType = determineResultType(result); |
@@ -356,20 +355,12 @@ public LogicalPlan visitArithmeticBinary(PromqlBaseParser.ArithmeticBinaryContex |
356 | 355 |
|
357 | 356 | return switch (binaryOperator) { |
358 | 357 | case ArithmeticOp arithmeticOp -> new VectorBinaryArithmetic(source, le, re, modifier, arithmeticOp); |
359 | | - case ComparisonOp comparisonOp -> new VectorBinaryComparison( |
360 | | - source, |
361 | | - le, |
362 | | - re, |
363 | | - modifier, |
364 | | - bool, |
365 | | - comparisonOp |
366 | | - ); |
| 358 | + case ComparisonOp comparisonOp -> new VectorBinaryComparison(source, le, re, modifier, bool, comparisonOp); |
367 | 359 | case VectorBinarySet.SetOp setOp -> new VectorBinarySet(source, le, re, modifier, setOp); |
368 | 360 | default -> throw new ParsingException(source(ctx.op), "Unknown arithmetic {}", opText); |
369 | 361 | }; |
370 | 362 | } |
371 | 363 |
|
372 | | - |
373 | 364 | private BinaryOp binaryOp(Token opType) { |
374 | 365 | return switch (opType.getType()) { |
375 | 366 | case CARET -> ArithmeticOp.POW; |
|
0 commit comments