Repository navigation
Commit cb0023a
committed
Always lower a bucket function to a span
Review feedback: a histogram expression should end up as an OpenSearch
histogram aggregate, so generating date_format or timestampadd was surprising.
It is, and they are gone -- `format` and `time_zone` now defer to the legacy
engine along with alias, min_doc_count and order.
The legacy engine implements all five natively (AggMaker builds them straight
onto the date_histogram aggregation), and for time_zone it does so better:
`dateHistogram.timeZone(ZoneOffset.of(value))` shifts bucket boundaries
properly, where this code was adding a fixed number of seconds and would have
been wrong across a daylight-saving change. Handing those queries back means
they are answered by the implementation that already had them right.
What is left always produces a Span, which is what the earlier comment about
lowering to existing AST primitives described. `missing` still wraps the field
in `ifnull`, since substituting a value has to happen before bucketing.
Verified on a live cluster: the plain and `missing` forms answer from V2
(12/24/17/19 and 19/20/20/13), while `format`, `time_zone` and `alias` reach
legacy and answer correctly -- time_zone returning 5/18/30/19, the shifted
boundaries. 983 default-route tests pass, and `:sql:build` is green including
the coverage gate.
Signed-off-by: Jialiang Liang <ryanleeang@gmail.com>1 parent 981a438 commit cb0023a
3 files changed
Lines changed: 15 additions & 74 deletions
File tree
- integ-test/src/test/java/org/opensearch/sql/sql
- sql/src
- main/java/org/opensearch/sql/sql/parser
- test/java/org/opensearch/sql/sql/parser
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
190 | | - | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
| |||
Lines changed: 6 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
| |||
193 | 192 | | |
194 | 193 | | |
195 | 194 | | |
196 | | - | |
197 | | - | |
198 | 195 | | |
199 | | - | |
200 | | - | |
201 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
202 | 200 | | |
203 | 201 | | |
204 | 202 | | |
205 | 203 | | |
206 | 204 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
| 205 | + | |
| 206 | + | |
213 | 207 | | |
214 | 208 | | |
215 | 209 | | |
| |||
242 | 236 | | |
243 | 237 | | |
244 | 238 | | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | 239 | | |
258 | 240 | | |
259 | 241 | | |
| |||
283 | 265 | | |
284 | 266 | | |
285 | 267 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | 268 | | |
305 | 269 | | |
306 | 270 | | |
| |||
Lines changed: 6 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
910 | 910 | | |
911 | 911 | | |
912 | 912 | | |
913 | | - | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
919 | | - | |
920 | | - | |
921 | | - | |
922 | | - | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | | - | |
928 | | - | |
929 | | - | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
934 | 913 | | |
935 | 914 | | |
936 | 915 | | |
| |||
944 | 923 | | |
945 | 924 | | |
946 | 925 | | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
947 | 932 | | |
948 | 933 | | |
949 | 934 | | |
| |||
955 | 940 | | |
956 | 941 | | |
957 | 942 | | |
958 | | - | |
959 | | - | |
960 | | - | |
961 | | - | |
962 | | - | |
963 | | - | |
964 | | - | |
965 | | - | |
966 | | - | |
967 | 943 | | |
968 | 944 | | |
969 | 945 | | |
| |||
0 commit comments