Skip to content
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

SQL: use calendar interval of 1y instead of fixed interval for grouping by YEAR and HISTOGRAMs #47558

Merged
merged 4 commits into from
Oct 9, 2019

Conversation

astefan
Copy link
Contributor

@astefan astefan commented Oct 4, 2019

Because Elasticsearch forces users to use a fixed interval for all nX periods of time (3 days, 4 years, 5 months etc), to have a consistent behavior throughout SQL, the fixed_interval approach was chosen. But this resulted in having an unintuitive behavior for intervals of one year.
This PR changes grouping by YEAR() and HISTOGRAMs with INTERVAL '1' YEAR to use a date_histogram with calendar_interval of 1y.

Fixes #40162.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/SQL)

Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@costin costin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@costin
Copy link
Member

costin commented Oct 7, 2019

Make sure to indicate the versions selected for backporting. Considering it's a behavior change, I'm on the fence on whether we should do any backporting.

@astefan
Copy link
Contributor Author

astefan commented Oct 9, 2019

@elasticmachine run elasticsearch-ci/packaging-sample

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQL: inconsistent results for YEAR method
5 participants