Commit 1fc18be
* feat(query-engine): computed top-k in range queries + stage-E equivalence tests (#581 stage E prep)
Adds step-major topk ranking/truncation to execute_range_query_pipeline
(previously range had no top-k support at all), wires it through PromQL's
range call sites, and adds an instant/range equivalence test matrix across
Tumbling/Sliding window shapes and SetAgg/DeltaSetAgg keys configs, ahead
of stage E's full pipeline collapse.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(query-engine): drop dead-code retain in apply_range_topk (roborev #23)
kept_timestamps_by_key's entries are only ever inserted alongside a
timestamp drawn from that same element's own samples, so the per-sample
filter can never leave a surviving key's samples empty -- the trailing
retain was unreachable dead code.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(query-engine): pin topk binary-expr label bugs found via PR #629 Finding 1
topk(...) as one arm of a binary expression is broken two different
ways, neither of which is what Finding 1's review comment described nor
fixable as part of #629 -- both are pre-existing/orthogonal and tracked
in #631 instead. One test pins the current (surprising) None-return
behavior; the other reproduces the join-corruption bug Finding 1
actually describes, and is #[ignore]d since it isn't fixed here.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(query-engine): deterministic range topk tie-break, fewer label clones
Addresses PR #629 review findings 2-4 (mod.rs::apply_range_topk):
- Finding 2: candidates.sort_by was value-only with no tiebreak, so
groups tied at the k-th value boundary kept a different survivor
run to run (HashMap iteration order is randomized per-process).
Confirmed via a flaky RED test (4/5 pass rate) before adding a
label-values tiebreak; stable across 20+ runs after.
- Finding 3: folded into the same restructure -- index each group once
instead of cloning its label vector per (group, timestamp) sample
(G clones instead of G*T).
- Finding 4: documented why range has no observable (false, true)
case for enable_topk_limiting/enable_topk_formatting, unlike
instant's always-sort-when-Topk behavior.
Finding 1 is not addressed here -- tracked separately in #631.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 09ff227 commit 1fc18be
5 files changed
Lines changed: 1122 additions & 8 deletions
File tree
- asap-query-engine/src
- engines/simple_engine
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1500 | 1500 | | |
1501 | 1501 | | |
1502 | 1502 | | |
1503 | | - | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
1504 | 1512 | | |
1505 | 1513 | | |
1506 | 1514 | | |
| 1515 | + | |
| 1516 | + | |
1507 | 1517 | | |
1508 | 1518 | | |
1509 | 1519 | | |
| |||
1829 | 1839 | | |
1830 | 1840 | | |
1831 | 1841 | | |
1832 | | - | |
1833 | | - | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
1834 | 1980 | | |
1835 | 1981 | | |
1836 | 1982 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
720 | | - | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
721 | 724 | | |
722 | 725 | | |
723 | 726 | | |
| |||
745 | 748 | | |
746 | 749 | | |
747 | 750 | | |
748 | | - | |
749 | | - | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
750 | 758 | | |
751 | 759 | | |
752 | 760 | | |
| |||
1307 | 1315 | | |
1308 | 1316 | | |
1309 | 1317 | | |
1310 | | - | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
1311 | 1321 | | |
1312 | | - | |
| 1322 | + | |
1313 | 1323 | | |
1314 | 1324 | | |
1315 | 1325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
0 commit comments