OpenSearch/x-pack/plugin/sql
Marios Trivyzas b0cb7bf229 SQL: Fix issue with GROUP BY YEAR() (#49559)
Grouping By YEAR() is translated to a histogram aggregation, but
previously if there was a scalar function invloved (e.g.:
`YEAR(date + INTERVAL 2 YEARS)`), there was no proper script created
and the histogram was applied on a field with name: `date + INTERVAL 2 YEARS`
which doesn't make sense, and resulted in null result.

Check the underlying field of YEAR() and if it's a function call
`asScript()` to properly get the painless script on which the histogram
is applied.

Fixes: #49386
(cherry picked from commit 93c37abc943d00d3a14ba08435d118a6d48874c7)
2019-11-26 14:11:11 +01:00
..
jdbc Clean up static web server in sql-client tests (#49187) (#49197) 2019-11-15 13:02:21 -07:00
qa SQL: Fix issue with GROUP BY YEAR() (#49559) 2019-11-26 14:11:11 +01:00
sql-action Apply 2-space indent to all gradle scripts (#49071) 2019-11-14 11:01:23 +00:00
sql-cli Apply 2-space indent to all gradle scripts (#49071) 2019-11-14 11:01:23 +00:00
sql-client Clean up static web server in sql-client tests (#49187) (#49197) 2019-11-15 13:02:21 -07:00
sql-proto Apply 2-space indent to all gradle scripts (#49071) 2019-11-14 11:01:23 +00:00
src SQL: Fix issue with GROUP BY YEAR() (#49559) 2019-11-26 14:11:11 +01:00
build.gradle Apply 2-space indent to all gradle scripts (#49071) 2019-11-14 11:01:23 +00:00