-
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
Multiple date formats in date_histogram aggregation #39916
Comments
Pinging @elastic/es-analytics-geo |
This appears to be a general problem with multiple formats, likely introduced/broken in #37222 We're using I traced through the code and this does indeed appear to be the case. When @pgomulka @rjernst any ideas? This is hitting the edge of my java-time knowledge. I skimmed the API and I'm thinking we may need to drop back to an array of parsers, and check them individually with |
It seems this affects anything using multiple patterns, most notably it breaks indexing:
( EDIT: Doesn't appear as bad as I thought. |
I think @polyfractal suggestion would work best.
Couldn't find this in javadocs, but looks like DateTimeFormatter's patterns with optional depend on ordering. Someone raised a JDK bug, but it was closed as a non issue with comment:
https://bugs.openjdk.java.net/browse/JDK-8188771 I don't think this is ideal, but we can workaround this with an approach from stackoverflow comment linked by @polyfractal |
Java-time fails parsing composite patterns when first pattern matches only the prefix of the input. It expects pattern in longest-shortest order. Joda does not suffer from this closes elastic#39916
Pinging @elastic/es-core-infra |
the alternative to the PR above is just to state in a documentation that patterns have to be in order (longest to shortest / most strict/least strict) |
You're right but I think that's too trappy. |
Java-time fails parsing composite patterns when first pattern matches only the prefix of the input. It expects pattern in longest-shortest order. Joda does not suffer from this closes elastic#39916
Java-time fails parsing composite patterns when first pattern matches only the prefix of the input. It expects pattern in longest to shortest order. Because of this constructing just one DateTimeFormatter with appendOptional is not sufficient. Parsers have to be iterated and if the parsing fails, the next one in order should be used. In order to not degrade performance parsing should not be throw exceptions on failure. Format.parseObject was used as it only returns null when parsing failed and allows to check if full input was read. closes #39916
Java-time fails parsing composite patterns when first pattern matches only the prefix of the input. It expects pattern in longest to shortest order. Because of this constructing just one DateTimeFormatter with appendOptional is not sufficient. Parsers have to be iterated and if the parsing fails, the next one in order should be used. In order to not degrade performance parsing should not be throw exceptions on failure. Format.parseObject was used as it only returns null when parsing failed and allows to check if full input was read. closes elastic#39916
Java-time fails parsing composite patterns when first pattern matches only the prefix of the input. It expects pattern in longest to shortest order. Because of this constructing just one DateTimeFormatter with appendOptional is not sufficient. Parsers have to be iterated and if the parsing fails, the next one in order should be used. In order to not degrade performance parsing should not be throw exceptions on failure. Format.parseObject was used as it only returns null when parsing failed and allows to check if full input was read. closes elastic#39916
Java-time fails parsing composite patterns when first pattern matches only the prefix of the input. It expects pattern in longest to shortest order. Because of this constructing just one DateTimeFormatter with appendOptional is not sufficient. Parsers have to be iterated and if the parsing fails, the next one in order should be used. In order to not degrade performance parsing should not be throw exceptions on failure. Format.parseObject was used as it only returns null when parsing failed and allows to check if full input was read. closes elastic#39916
) (#40501) Java-time fails parsing composite patterns when first pattern matches only the prefix of the input. It expects pattern in longest to shortest order. Because of this constructing just one DateTimeFormatter with appendOptional is not sufficient. Parsers have to be iterated and if the parsing fails, the next one in order should be used. In order to not degrade performance parsing should not be throw exceptions on failure. Format.parseObject was used as it only returns null when parsing failed and allows to check if full input was read. closes #39916 backport #40100
) (#40502) Java-time fails parsing composite patterns when first pattern matches only the prefix of the input. It expects pattern in longest to shortest order. Because of this constructing just one DateTimeFormatter with appendOptional is not sufficient. Parsers have to be iterated and if the parsing fails, the next one in order should be used. In order to not degrade performance parsing should not be throw exceptions on failure. Format.parseObject was used as it only returns null when parsing failed and allows to check if full input was read. closes #39916 backport #40100
) (#40503) Java-time fails parsing composite patterns when first pattern matches only the prefix of the input. It expects pattern in longest to shortest order. Because of this constructing just one DateTimeFormatter with appendOptional is not sufficient. Parsers have to be iterated and if the parsing fails, the next one in order should be used. In order to not degrade performance parsing should not be throw exceptions on failure. Format.parseObject was used as it only returns null when parsing failed and allows to check if full input was read. closes #39916 backport #40100
The following worked in
6.x
In
7.0.0-beta1
it fails with the following:Specifying only
Results in no error however.
The text was updated successfully, but these errors were encountered: