-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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: inconsistent results for YEAR method #40162
Comments
Pinging @elastic/es-search |
@astefan I don't get why this is an issue, it's expected behaviour.
which is the expected result. |
Look carefully at the first and second tests results for YEAR. In the first one you have 2017, while in the second you don't but you have 2019. It's about how intervals work in ES and @costin mentioned this is the correct behavior, but imo it's an unexpected behavior from end user point of view and we'll probably hear about this some more in the future. |
Sorry, completely missed that. and I now I remember the discussion on this. |
One more thing I'd like to mention, not to lose track of it: the |
looks like this will probably be resolved by #43922 |
@sophiec20 SQL uses, at the moment, an So, the way it works now (with #43922 will not fix this. The actual fix is to switch from using a |
Yeah same issue here. After recommending ES for a new project it was a bit embarrassing to see basic queries returning wrong results lol. but anyway, is this the best way to solve it for now ? is there an expected patch/release date for this fix? |
@avierr
can replace YEAR ? |
Atleast I get a similar result, but instead of 2019, I get 2019.0 |
For the following test data:
and query
SELECT count(*), YEAR(certified) year FROM certification WHERE certified > 0 GROUP BY year
we get:But for a slightly modified query (by adding another grouping):
SELECT count(*), YEAR(certified) year FROM certification WHERE certified > 0 GROUP BY year, certified
we get:The text was updated successfully, but these errors were encountered: