Skip to content

Theta preamble diagnostic misreports historical single-item images #773

Closed

Description

@jaideeppyne

Problem

theta.PreambleUtil.preambleToString() derives CurrentCount for one-preamble-long images from SINGLEITEM_FLAG_MASK.

Historical C++ single-item images may omit that flag. Java accepts those images because the theta parser deliberately does not depend on the flag, but the diagnostic output reports CurrentCount: 0 even though the image contains one retained item.

This was identified while resolving the cross-language differences tracked in apache/datasketches-cpp#460. Current C++ now writes the flag, but older valid images still expose the diagnostic mismatch.

Expected behavior

For a one-preamble-long theta image, derive the diagnostic count from the empty flag:

  • empty image: CurrentCount: 0
  • non-empty image: CurrentCount: 1

The printed SINGLE_ITEM field should continue to reflect the serialized flag itself.

Proposed test

Serialize a single-item compact sketch, clear only the single-item flag to model a historical C++ image, and verify that preambleToString() reports CurrentCount: 1 while preserving SINGLE_ITEM: false.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions