Skip to content

Fix sql time and timestamp locale tests on java 20+#410

Merged
garydgregory merged 1 commit into
apache:masterfrom
rootvector2:sql-locale-time-separator
Jul 2, 2026
Merged

Fix sql time and timestamp locale tests on java 20+#410
garydgregory merged 1 commit into
apache:masterfrom
rootvector2:sql-locale-time-separator

Conversation

@rootvector2

Copy link
Copy Markdown
Contributor

Follow-up to the request on #406 to fix the SQL test failures on Java 25 and up.

SqlTimeConverterTest.testLocale and SqlTimestampConverterTest.testLocale fail on JDK 20+ because CLDR changed the US SHORT time format to use a narrow no-break space (U+202F) before the AM/PM marker instead of a regular space. The locale converter parses using the JVM's own DateFormat, so it expects U+202F, while the tests hard-coded a regular space in both the input string and the pattern that computes the expected value (and toCalendar parses non-lenient). The non-SQL date test only uses a date pattern, which is why it wasn't affected.

Rather than hard-code either separator, the tests now derive it from the running JVM's SHORT time format, so they pass on both older JDKs (regular space) and JDK 20+ (U+202F).

Verified failing before and passing after on OpenJDK 26; full suite still green on JDK 21.

  • Read the contribution guidelines for this project.
  • Read the ASF Generative Tooling Guidance if you use Artificial Intelligence (AI).
  • I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute?
  • Run a successful build using the default Maven goal with mvn; that's mvn on the command line by itself.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This is a test-only fix; there is no runtime change.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.

The US SHORT time format switched the AM/PM separator to a narrow
no-break space (U+202F) in CLDR (JDK 20+), so the locale converter
parses that separator while the tests hard-coded a regular space.
Derive the separator from the JVM's own format so the tests pass on
both old and new JDKs.

Signed-off-by: Naveed Khan <dxbnaveed.k@gmail.com>
@garydgregory garydgregory changed the title fix sql time and timestamp locale tests on java 20+ Fix sql time and timestamp locale tests on java 20+ Jul 2, 2026
@garydgregory garydgregory merged commit 0b200f0 into apache:master Jul 2, 2026
9 checks passed
garydgregory added a commit that referenced this pull request Jul 2, 2026
@garydgregory

Copy link
Copy Markdown
Member

Hello @rootvector2

Merged 🚀 Please port to the 1.X branch BUT take into account the copy-pasta clean I did in f5494fd after merging this PR.

TY!

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.

2 participants