Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -158,15 +158,15 @@ private static EvalOperator.ExpressionEvaluator evaluator(String operation) {
FieldAttribute longField = longField();
yield EvalMapper.toEvaluator(
FOLD_CONTEXT,
new Add(Source.EMPTY, longField, new Literal(Source.EMPTY, 1L, DataType.LONG)),
new Add(Source.EMPTY, longField, new Literal(Source.EMPTY, 1L, DataType.LONG), configuration()),
layout(longField)
).get(driverContext);
}
case "add_double" -> {
FieldAttribute doubleField = doubleField();
yield EvalMapper.toEvaluator(
FOLD_CONTEXT,
new Add(Source.EMPTY, doubleField, new Literal(Source.EMPTY, 1D, DataType.DOUBLE)),
new Add(Source.EMPTY, doubleField, new Literal(Source.EMPTY, 1D, DataType.DOUBLE), configuration()),
layout(doubleField)
).get(driverContext);
}
Expand All @@ -177,8 +177,8 @@ private static EvalOperator.ExpressionEvaluator evaluator(String operation) {
Expression lhs = f1;
Expression rhs = f2;
if (operation.endsWith("lazy")) {
lhs = new Add(Source.EMPTY, lhs, new Literal(Source.EMPTY, 1L, DataType.LONG));
rhs = new Add(Source.EMPTY, rhs, new Literal(Source.EMPTY, 1L, DataType.LONG));
lhs = new Add(Source.EMPTY, lhs, new Literal(Source.EMPTY, 1L, DataType.LONG), configuration());
rhs = new Add(Source.EMPTY, rhs, new Literal(Source.EMPTY, 1L, DataType.LONG), configuration());
}
EvalOperator.ExpressionEvaluator evaluator = EvalMapper.toEvaluator(
FOLD_CONTEXT,
Expand All @@ -196,7 +196,7 @@ private static EvalOperator.ExpressionEvaluator evaluator(String operation) {
FieldAttribute f2 = longField();
Expression lhs = f1;
if (operation.endsWith("lazy")) {
lhs = new Add(Source.EMPTY, lhs, new Literal(Source.EMPTY, 1L, DataType.LONG));
lhs = new Add(Source.EMPTY, lhs, new Literal(Source.EMPTY, 1L, DataType.LONG), configuration());
}
EvalOperator.ExpressionEvaluator evaluator = EvalMapper.toEvaluator(
FOLD_CONTEXT,
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog/140101.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 140101
summary: "Add timezone to add and sub operators, and `ConfigurationAware` planning\
\ support"
area: ES|QL
type: feature
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,21 @@ a:datetime
null
;

dateMathWithTimezonesRow
required_capability: add_sub_operator_timezone_support

set time_zone="America/New_York"\;
row
date_add = "2025-03-09T01:02:03.123-05:00" + 1d,
date_sub = "2025-03-10T01:02:03.123-04:00" - 1d,
nanos_add = "2025-03-09T01:02:03.123000001-05:00"::date_nanos + 1d,
nanos_sub = "2025-03-10T01:02:03.123000001-04:00"::date_nanos - 1d
;

date_add:datetime | date_sub:datetime | nanos_add:date_nanos | nanos_sub:date_nanos
2025-03-10T05:02:03.123Z | 2025-03-09T06:02:03.123Z | 2025-03-10T05:02:03.123000001Z | 2025-03-09T06:02:03.123000001Z
;

ImplicitCastingEqual
required_capability: rangequery_for_datetime
from employees
Expand Down
14 changes: 14 additions & 0 deletions x-pack/plugin/esql/qa/testFixtures/src/main/resources/row.csv-spec
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ a:integer | b:integer | c:integer
1 | 2 | 3
;

rowWithArithmeticOperators
row a = 1 + 4;

a:integer
5
;

rowWithComparisonOperators
row a = 1 < 4;

a:boolean
true
;

evalRowWithNull
row a = 1, b = 2, c = null | eval z = c+b+a;

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading