-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Unable to parse certain dates due to AM/PM issues #58986
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
Comments
Pinging @elastic/es-core-infra (:Core/Infra/Core) |
looks like indeed we have a bug. this affects all 7.x versions. I think #46654 is not related - the problem can be reproduced in 7.4 without that change. |
I think the fix might involve appending custom parseDefaulting-style parser which will treat hour of day and hour_of_ampm same way. |
I don't think we can fix this easily. Overriding We should probably consider document what fields are possible to be rounded. Possibly some of our predefined formats are also incorrectly rounded. After parsing when resolving fields hour related fields are resolved to HOUR_OF_DAY My expectation was that |
AM/PM use case might not common, but there are more. Some of them we define as part of our build-in formats https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html We discussed this in the past and we wanted to limit the number of build-in formats, but a user can always define his own format in a similar fashion. The pattern to reproduce is to define a format that can resolve to a full date with year, month, day, hour, minute, second, nanoseconds but with the use of other fields (am/pm, week of year, day of week, nano of year, day of year etc) This forces good news is that cc @colings86 |
this is still an issue |
Date rounding logic should take into account the fields that will be parsed be a parser. If a parser has a DayOfYear field, the rounding logic should not try to default DayOfMonth as it will conflict with DayOfYear However the DateTimeFormatter does not have a public method to return information of fields that will be parsed. The hacky workaround is to rely on toString() implementation that will return a field info when it was defined with textual pattern. This commits introduced conditional logic for DayOfYear, ClockHourOfAMPM and HourOfAmPM closes elastic#89096 closes elastic#58986
Date rounding logic should take into account the fields that will be parsed be a parser. If a parser has a DayOfYear field, the rounding logic should not try to default DayOfMonth as it will conflict with DayOfYear However the DateTimeFormatter does not have a public method to return information of fields that will be parsed. The hacky workaround is to rely on toString() implementation that will return a field info when it was defined with textual pattern. This commits introduced conditional logic for DayOfYear, ClockHourOfAMPM and HourOfAmPM closes #89096 closes #58986
Date rounding logic should take into account the fields that will be parsed be a parser. If a parser has a DayOfYear field, the rounding logic should not try to default DayOfMonth as it will conflict with DayOfYear However the DateTimeFormatter does not have a public method to return information of fields that will be parsed. The hacky workaround is to rely on toString() implementation that will return a field info when it was defined with textual pattern. This commits introduced conditional logic for DayOfYear, ClockHourOfAMPM and HourOfAmPM closes elastic#89096 closes elastic#58986
Date rounding logic should take into account the fields that will be parsed be a parser. If a parser has a DayOfYear field, the rounding logic should not try to default DayOfMonth as it will conflict with DayOfYear However the DateTimeFormatter does not have a public method to return information of fields that will be parsed. The hacky workaround is to rely on toString() implementation that will return a field info when it was defined with textual pattern. This commits introduced conditional logic for DayOfMonth, MonthOfYear, ClockHourOfAMPM and HourOfAmPM closes #89096 closes #58986 backports #89693
Date rounding logic should take into account the fields that will be parsed be a parser. If a parser has a DayOfYear field, the rounding logic should not try to default DayOfMonth as it will conflict with DayOfYear However the DateTimeFormatter does not have a public method to return information of fields that will be parsed. The hacky workaround is to rely on toString() implementation that will return a field info when it was defined with textual pattern. This commits introduced conditional logic for DayOfYear, ClockHourOfAMPM and HourOfAmPM closes elastic#89096 closes elastic#58986
Date rounding logic should take into account the fields that will be parsed be a parser. If a parser has a DayOfYear field, the rounding logic should not try to default DayOfMonth as it will conflict with DayOfYear However the DateTimeFormatter does not have a public method to return information of fields that will be parsed. The hacky workaround is to rely on toString() implementation that will return a field info when it was defined with textual pattern. This commits introduced conditional logic for DayOfYear, ClockHourOfAMPM and HourOfAmPM closes #89096 closes #58986 backports #89693
Elasticsearch version: 7.6+
Description of the problem including expected versus actual behavior:
I am not entirely sure what exactly the problem is, but there is some parsing logic with rounding dates up that causes parsing exceptions that do not look like they should be parsing exceptions.
I've written a unit test in
JavaDateMathParserTests.java
that reproduces the believed issue:when
roundUpProperty
is set to true, parsing fails.Steps to reproduce:
might be related to #46654 cc @pgomulka
The text was updated successfully, but these errors were encountered: