GitHub user tisonkun created a discussion: Family ID 19 collision between EBPPS and DensitySketch
While implementing `DensitySketch` in `datasketches-rust` ([apache/datasketches-rust#62](https://github.com/apache/datasketches-rust/pull/62)), we noticed that **Family ID 19** is currently used by two different sketches: | Sketch | Language(s) | Preamble byte 0 | `ser_ver` | `family_id` | Source | | ----------------------------------- | ----------------- | ---------------------------- | --------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `density_sketch` | C++, Python | `preamble_ints` in `{3, 6}` | `1` | `19` | [`density_sketch.hpp`](https://github.com/apache/datasketches-cpp/blob/70b86faa63402d7f62f5a6b1b05109d5fd1f2186/density/include/density_sketch.hpp#L202) (added in Apr 2023) | | `ebpps_sketch` / `EbppsItemsSketch` | Java, C++, Python | `preamble_longs` in `{1, 5}` | `1` | `19` | [`Family.java`](https://github.com/apache/datasketches-java/blob/059b5a9ccf15f4036a50624cc910128e6b015636/src/main/java/org/apache/datasketches/common/Family.java#L154), [`ebpps_sketch.hpp`](https://github.com/apache/datasketches-cpp/blob/70b86faa63402d7f62f5a6b1b05109d5fd1f2186/sampling/include/ebpps_sketch.hpp#L258) (added in Jan 2024) | Because byte 0 happens to be disjoint (`{3, 6}` vs. `{1, 5}`), cross-deserializing one as the other fails on the preamble check rather than silently corrupting data. However, `Family` IDs are meant to be globally unique: Java's `Family.idToFamily(int)` enforces a 1-to-1 ID map (`XORFILTER` currently occupies `22`), and any header inspection or multi-sketch support in Java/Rust/Go runs into the collision. ### Questions 1. Should we keep `19` for `EBPPS` and assign **Family ID `23` (`DENSITY`)** in `Family.java` and across implementations before more languages ship `DensitySketch`? 2. For backward compatibility with existing C++/Python `density_sketch` blobs, should readers accept legacy `family_id == 19` alongside `23` (while all new writers emit `23`), or only support `19` in C++ as a legacy path? GitHub link: https://github.com/apache/datasketches-tck/discussions/23 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
