-
Notifications
You must be signed in to change notification settings - Fork 25.7k
DATE_RANGE data type for esql #133309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
DATE_RANGE data type for esql #133309
Changes from 19 commits
a8467fc
ac9eaa2
b5cd87f
1c0b353
8b6d47c
053f0cb
4d4bf61
720dd36
5dc672b
3231b83
84f8a6d
983b2c9
1fbac8e
5791f06
cde8323
8bb26b2
4937985
ab1506e
879d71f
83e5571
fea50ba
156754e
4e77c92
ed01a9d
ed04e57
d1eb012
0b5926b
95d061c
9ec1055
547fcfa
37f1349
3ad8726
52285cd
0ef554e
496f7bc
c81e076
1c72c2c
e48b8c8
30ced99
28b856f
487a593
131ed34
1954260
2669505
4940de5
077ef04
3862723
19c78d4
2304569
2a7a4f6
c8d7df1
16eb6a1
b431e61
659067c
1a36f1d
fd007e4
0e000ab
47fa01b
fc657c6
b8961d1
c657385
6d7d5d1
71ac3dd
c445c61
eab89c6
06e959c
be0c506
24768ec
9cf00b0
e9a24e4
a20c68a
d32e5ec
e23f909
af31b71
787751a
1b81144
9a92f47
73dc3a5
afe81de
eefe858
4fe26b6
bb96d8d
a9fe602
e348b4f
73bf119
2a3a101
3643b7d
4d18f25
769b8b4
2a8d7e4
ec3a575
dc603ca
f3f5cba
b452bb1
e240b54
ce5dc58
698e0a1
d43d554
16a1578
66db920
9c242fe
fbe6964
3500708
0b58bc1
b9855f2
1c688eb
77dcdf5
875202f
b2d3702
3a21924
96d6aff
819f8a4
f522890
24e691c
c5087e7
0dabc02
65fe721
72bfe07
801f6cc
88910d9
d15d3a2
08261e4
e12d810
c89befe
fd43f2d
e4587b0
a1ac3c4
a679cc0
6823095
5cf18e3
322c9e5
2f5a645
f141d3b
0f62403
1b1cea2
680ea4d
d178ede
6ce85a9
345b9d8
a652b6f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 133309 | ||
| summary: support DATE_RANGE field type | ||
| area: ES|QL | ||
| type: enhancement | ||
| issues: [] |
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.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 9198000 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| dimension_values,9197000 | ||
| esql_date_range_created_version,9198000 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
| import static org.elasticsearch.xpack.esql.core.type.DataType.AGGREGATE_METRIC_DOUBLE; | ||
| import static org.elasticsearch.xpack.esql.core.type.DataType.BOOLEAN; | ||
| import static org.elasticsearch.xpack.esql.core.type.DataType.DATETIME; | ||
| import static org.elasticsearch.xpack.esql.core.type.DataType.DATE_RANGE; | ||
| import static org.elasticsearch.xpack.esql.core.type.DataType.DENSE_VECTOR; | ||
| import static org.elasticsearch.xpack.esql.core.type.DataType.IP; | ||
| import static org.elasticsearch.xpack.esql.core.type.DataType.NULL; | ||
|
|
@@ -85,10 +86,10 @@ public static TypeResolution isRepresentableExceptCountersDenseVectorAndAggregat | |
| ) { | ||
| return isType( | ||
| e, | ||
| dt -> isRepresentable(dt) && dt != DENSE_VECTOR && dt != AGGREGATE_METRIC_DOUBLE, | ||
| dt -> isRepresentable(dt) && dt != DENSE_VECTOR && dt != AGGREGATE_METRIC_DOUBLE && dt != DATE_RANGE, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to exclude this type from many functions. Is that because we plan to add that support in followup PRs?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct. It's probably worth thinking about this name if we're going to keep date_range here. but I think it's pretty reasonable to remove this in the next PR and add support to as many functions as we can.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably worth a comment that this is temporary while under construction. I'm not 100% sure why we need this to be honest though - I had thought we didn't try sending these "under construction" types in tests already. |
||
| operationName, | ||
| paramOrd, | ||
| "any type except counter types, dense_vector, or aggregate_metric_double" | ||
| "any type except counter types, dense_vector, aggregate_metric_double or date_range" | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -99,10 +100,14 @@ public static TypeResolution isRepresentableExceptCountersSpatialDenseVectorAndA | |
| ) { | ||
| return isType( | ||
| e, | ||
| (t) -> isSpatialOrGrid(t) == false && DataType.isRepresentable(t) && t != DENSE_VECTOR && t != AGGREGATE_METRIC_DOUBLE, | ||
| (t) -> isSpatialOrGrid(t) == false | ||
| && DataType.isRepresentable(t) | ||
| && t != DENSE_VECTOR | ||
| && t != AGGREGATE_METRIC_DOUBLE | ||
| && t != DATE_RANGE, | ||
craigtaverner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| operationName, | ||
| paramOrd, | ||
| "any type except counter, spatial types, dense_vector, or aggregate_metric_double" | ||
| "any type except counter, spatial types, dense_vector, aggregate_metric_double or date_range" | ||
| ); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |
| import java.util.stream.Collectors; | ||
|
|
||
| import static java.util.stream.Collectors.toMap; | ||
| import static org.elasticsearch.index.mapper.RangeFieldMapper.ESQL_DATE_RANGE_CREATED_VERSION; | ||
|
|
||
| /** | ||
| * This enum represents data types the ES|QL query processing layer is able to | ||
|
|
@@ -270,6 +271,10 @@ public enum DataType implements Writeable { | |
| * Nanosecond precision date, stored as a 64-bit signed number. | ||
| */ | ||
| DATE_NANOS(builder().esType("date_nanos").estimatedSize(Long.BYTES).docValues().supportedOnAllNodes()), | ||
| /** | ||
| * Represents a half-inclusive range between two dates. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it half-inclusive? I saw a comment in the RangeFieldMapper that indicates this is fully inclusive.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correction, I followed the code from the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed, it is a half inclusive. |
||
| */ | ||
| DATE_RANGE(builder().esType("date_range").estimatedSize(2 * Long.BYTES).docValues().supportedOn(ESQL_DATE_RANGE_CREATED_VERSION)), | ||
| /** | ||
| * IP addresses. IPv4 address are always | ||
| * <a href="https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5">embedded</a> | ||
|
|
@@ -982,5 +987,6 @@ private static class DataTypesTransportVersions { | |
| public static final TransportVersion ESQL_AGGREGATE_METRIC_DOUBLE_CREATED_VERSION = TransportVersion.fromName( | ||
| "esql_aggregate_metric_double_created_version" | ||
| ); | ||
|
|
||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.