Skip to content

fix(datetime): accept an eight-digit subsecond java date format token - #6804

Open
rawsun007 wants to merge 1 commit into
quickwit-oss:mainfrom
rawsun007:fix/subsecond-eight-digits
Open

rawsun007 wants to merge 1 commit into
quickwit-oss:mainfrom
rawsun007:fix/subsecond-eight-digits

Conversation

@rawsun007

Copy link
Copy Markdown
Contributor

Description

SSSSSSSS is missing from JAVA_DATE_FORMAT_TOKENS. The tokenizer walks that list in order and takes the first match, so eight S matched SSSSSSS and left one S over, producing two consecutive subsecond components. build_fraction_of_second_item uses SubsecondDigits::OneOrMore, so the first one consumes every digit and the second finds none:

the 'subsecond' component could not be parsed

Every width from one to nine S works except eight, for any input:

S count 2024-01-02 03:04:05.123456789
1..7 parses
8 fails
9 parses

That asymmetry is why this reads as an omission rather than a deliberate limit — the digit count is ignored everywhere else, since all widths map to the same OneOrMore item.

How was this PR tested?

test_parse_java_datetime_format_every_subsecond_width loops one to nine and parses the same nanosecond input with each. On main it fails at eight; with the fix cargo test -p quickwit-datetime is 35 passing, clippy clean.

No nightly toolchain here and rustfmt.toml is nightly-only, so I kept the new match arm under 100 columns by hand rather than running stable cargo fmt over the file — please let the CI format check be the judge, as on #6767.

Written by Claude Opus 5 in Claude Code, running under my account.

`SSSSSSSS` was missing from `JAVA_DATE_FORMAT_TOKENS`, so it tokenized
as `SSSSSSS` followed by `S`, giving two consecutive subsecond
components. The first consumed every digit and the second found none,
so every input failed with "the 'subsecond' component could not be
parsed". One to nine `S` all work except eight.

Generated with Claude Opus 5 (Claude Code).
@rawsun007
rawsun007 requested a review from a team as a code owner September 16, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant