Merged
Conversation
- Merged latest main (includes backend abstraction from PR #207) - Set all sketch backends to use sketchlib by default - Count-Min, Count-Min-With-Heap, and KLL all use sketchlib - UDFs correctly configured: all use sketchlib
milindsrivastava1997
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Integrates sketchlib-rust for KLL quantile sketches (single
KllSketchand multi-keyHydraKllSketch), completing the sketchlib migration alongside CMS and CMWH. Query engine uses the sameKllBackendenum pattern as earlier PRs; Arroyo UDF templates (datasketcheskll_,hydrakll_) are sketchlib-only (no dsrs dual path), matching the default of sketchlib for all sketch types. This branch merges currentmainand resolves conflicts in fidelity, CMS UDFimpl_moderendering, and tooling defaults.Changes
New Files
asap-common/sketch-core/src/kll_sketchlib.rsKLLSketchlibKll = KLLnew_sketchlib_kll,sketchlib_kll_update,sketchlib_kll_quantile,sketchlib_kll_merge,bytes_from_sketchlib_kll,sketchlib_kll_from_bytesModified Files
asap-common/sketch-core/src/lib.rspub mod kll_sketchlib;asap-common/sketch-core/src/kll.rsKllBackendenum (Legacy/Sketchlib)KllSketchholdsbackend: KllBackend;sketch_bytes(),count(),update,get_quantile,merge,merge_refs, msgpack serde dispatch through backendClone/Debugfor sketchlib path via byte round-trip where neededasap-common/sketch-core/src/config.rsDEFAULT_IMPL_MODE,DEFAULT_CMS_IMPL,DEFAULT_KLL_IMPL,DEFAULT_CMWH_IMPLallSketchlib(aligned with production defaults)asap-query-engine/src/precompute_operators/datasketches_kll_accumulator.rsKllSketch::sketch_bytes()/ msgpack path compatible with both backendsasap-summary-ingest/templates/udfs/datasketcheskll_.rs.j2sketchlib-rust,arroyo-udf-plugin,rmp-serde,serde(nodsrs)KLL::init_kll,SketchInput::F64, msgpackKllSketchDatawire formatasap-summary-ingest/templates/udfs/hydrakll_.rs.j2xxhash-rustfor row hashes; nestedKLLgrid serialized asHydraKllSketchDataasap-summary-ingest/run_arroyosketch.py--sketch_kll_impldefaultsketchlib(must match QueryEngine)impl_modeinjection fordatasketcheskll_/hydrakll_(templates no longer use it)asap-tools/experiments/experiment_utils/services/arroyo.pysketch_kll_implset tosketchlibfor experiment runsasap-common/sketch-core/src/bin/sketchlib_fidelity.rsrun_kll_once,run_hydra_kll_oncecms_mode,cmwh_mode,kll_mode(from--cms-impl,--cmwh-impl,--kll-impl)asap-common/sketch-core/report.mdasap-common/sketch-core/Cargo.tomldsrs/sketchlib-rustrevs consistent withmainTechnical Approach
Backend abstraction (QueryEngine / sketch-core)
Wire format (unchanged contract with Arroyo)
Both backends read/write this struct via MessagePack; sketch bytes are dsrs- or sketchlib-specific internally.
UDFs
Production UDFs always emit sketchlib KLL bytes. Legacy
KllBackendremains in sketch-core for tests (force_legacy_mode_for_tests), fidelity binaries, and deserialization of historical data.Testing
Quickstart (local images, KLL path) — optional local-only edits
To exercise quantile queries against images built from this branch:
asap-quickstart/docker-compose.yml, usebuildinstead ofimageforasap-planner-rs,asap-summary-ingest(context../asap-summary-ingest,dockerfile: Dockerfile), andqueryengine(context..,dockerfile: asap-query-engine/Dockerfile). Keeparroyoon the published image.asap-quickstart/config/controller-config.yaml, usequantile by (...) (0.5, sensor_reading)style queries andsketch_parameters.DatasketchesKLL.K: 20.python3 generate_dashboards.pydocker compose buildthendocker compose up, and comparehttp://localhost:8088/api/v1/queryvs Prometheus.Fidelity Results
KllSketch (absolute rank error)
HydraKllSketch
See
asap-common/sketch-core/report.mdfor full tables.