Skip to content

Fix theta preamble count for legacy single-item images - #774

Merged
leerho merged 1 commit into
apache:mainfrom
jaideeppyne:fix/theta-preamble-legacy-single-item
Oct 1, 2026
Merged

leerho merged 1 commit into
apache:mainfrom
jaideeppyne:fix/theta-preamble-legacy-single-item

Conversation

@jaideeppyne

Copy link
Copy Markdown
Contributor

Closes #773.

Historical C++ theta single-item images may omit the optional single-item flag. Java accepts these images, but PreambleUtil.preambleToString() previously derived the implied count from that flag and displayed CurrentCount: 0.

This change derives the one-preamble-long count from the authoritative empty flag while continuing to display the serialized single-item flag unchanged.

The regression test clears only the flag on a valid single-item image and verifies:

  • SINGLE_ITEM: false accurately reflects the historical bytes
  • CurrentCount: 1 accurately reflects the retained item

Validation:

  • mvn -t /private/tmp/jdk25-toolchains.xml -Dtest=org.apache.datasketches.theta.PreambleUtilTest test (8 tests)
  • mvn -t /private/tmp/jdk25-toolchains.xml test (2,287 tests)
  • git diff --check

@leerho leerho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This correctly fixes the preambleToString() single-item/empty count logic from issue #460—the one-line change is sound, CI passes, and the test properly validates the bug fix,

@leerho
leerho merged commit 059b5a9 into apache:main Oct 1, 2026
6 checks passed
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.

Theta preamble diagnostic misreports historical single-item images

2 participants