mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-30 22:54:12 +00:00
16 lines
12 KiB
HTML
16 lines
12 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Operators that depend on the whole set of evaluated series at each grid point: `topk`, `bottomk`, `limitk`, `limit_ratio`, `scalar`, `absent` and the instant-result sorts."><title>promql::select - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-1ed95124.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="promql" data-themes="" data-resource-suffix="" data-rustdoc-version="1.98.1 (48a229cea 2026-09-01)" data-channel="1.98.1" data-search-js="search-9944d736.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../../static.files/storage-41dd4d93.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-417ebf0a.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module select</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../promql/index.html">promql</a><span class="version">1.4.0-alpha.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module select</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate promql</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">promql</a></div><h1>Module <span>select</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/promql/select.rs.html#15-774">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Operators that depend on the whole set of evaluated series at each grid point: <code>topk</code>,
|
||
<code>bottomk</code>, <code>limitk</code>, <code>limit_ratio</code>, <code>scalar</code>, <code>absent</code> and the instant-result sorts.</p>
|
||
<p>Semantics follow Prometheus (<code>aggregationK</code>, <code>HashRatioSampler</code>, <code>funcScalar</code>, <code>funcAbsent</code>,
|
||
<code>createLabelsForAbsentFunction</code>, <code>funcSort*</code>). A scalar is a grid series without labels that
|
||
has a value at every point, so <code>vector(s)</code> is <code>s</code> itself and has no kernel.</p>
|
||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.LabelMatcher.html" title="struct promql::select::LabelMatcher">Label<wbr>Matcher</a></dt><dd>A label matcher of the selector <code>absent</code> is applied to.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Grouping.html" title="enum promql::select::Grouping">Grouping</a></dt><dd>The labels that form an aggregation group.</dd><dt><a class="enum" href="enum.MatchOp.html" title="enum promql::select::MatchOp">MatchOp</a></dt><dd>The operator of a <a href="struct.LabelMatcher.html" title="struct promql::select::LabelMatcher"><code>LabelMatcher</code></a>.</dd><dt><a class="enum" href="enum.SortOrder.html" title="enum promql::select::SortOrder">Sort<wbr>Order</a></dt><dd>The order <code>sort_instant</code> arranges an instant result in.</dd></dl><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.GO_NAN.html" title="constant promql::select::GO_NAN">GO_NAN</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Go’s <code>math.NaN()</code> bit pattern, which Prometheus returns for an undefined scalar.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.absent.html" title="fn promql::select::absent">absent</a></dt><dd><code>absent(v)</code>: 1 with <code>labels</code> at every point where no series is present.</dd><dt><a class="fn" href="fn.absent_labels.html" title="fn promql::select::absent_labels">absent_<wbr>labels</a></dt><dd>The labels of an <code>absent</code> result, as Prometheus <code>createLabelsForAbsentFunction</code> derives them:
|
||
the first equality matcher of a name sets that label, any other matcher of the name removes
|
||
it, and <code>__name__</code> is skipped.</dd><dt><a class="fn" href="fn.chunks.html" title="fn promql::select::chunks">chunks</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Maximal runs of ASCII digits and of other characters, like the regexp <code>(\d+|\D+)</code>.</dd><dt><a class="fn" href="fn.compare_labels.html" title="fn promql::select::compare_labels">compare_<wbr>labels</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Prometheus <code>labels.Compare</code>: label pairs in name order, then the shorter set first.</dd><dt><a class="fn" href="fn.cursor_value.html" title="fn promql::select::cursor_value">cursor_<wbr>value</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>The value a forward cursor reads at compact <code>row</code>; the rows asked for only increase.</dd><dt><a class="fn" href="fn.float_samples.html" title="fn promql::select::float_samples">float_<wbr>samples</a><span title="Restricted Visibility"> 🔒</span> </dt><dd><code>series</code> without its histogram samples, <code>None</code> when nothing else is left. One field, as <code>sort</code>
|
||
reads.</dd><dt><a class="fn" href="fn.grid_and_points.html" title="fn promql::select::grid_and_points">grid_<wbr>and_<wbr>points</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Checks every series against <code>schema</code> and returns the grid with its length.</dd><dt><a class="fn" href="fn.grid_points.html" title="fn promql::select::grid_points">grid_<wbr>points</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Checks every series against <code>schema</code> and returns the grid length.</dd><dt><a class="fn" href="fn.group_key.html" title="fn promql::select::group_key">group_<wbr>key</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.group_key_from.html" title="fn promql::select::group_key_from">group_<wbr>key_<wbr>from</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.into_value.html" title="fn promql::select::into_value">into_<wbr>value</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Callers filter histograms out first (<code>sort</code> drops them, <code>topk</code> selects only float candidates),
|
||
so a histogram here is a broken invariant.</dd><dt><a class="fn" href="fn.k_param.html" title="fn promql::select::k_param">k_param</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>The <code>k</code> of <code>topk</code>, <code>bottomk</code> and <code>limitk</code> as Prometheus reads it: nothing for <code>k</code> below 1, an
|
||
error for NaN or a value out of int64, otherwise <code>k</code> truncated and capped at the number of
|
||
input series.</dd><dt><a class="fn" href="fn.labels_with_name.html" title="fn promql::select::labels_with_name">labels_<wbr>with_<wbr>name</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>The label pairs of <code>metric</code> with <code>__name__</code> among them, sorted by name.</dd><dt><a class="fn" href="fn.limit_ratio.html" title="fn promql::select::limit_ratio">limit_<wbr>ratio</a></dt><dd><code>limit_ratio(r, ...)</code> with a constant <code>r</code>.</dd><dt><a class="fn" href="fn.limitk.html" title="fn promql::select::limitk">limitk</a></dt><dd><code>limitk(k, ...)</code> with a constant <code>k</code>.</dd><dt><a class="fn" href="fn.natural_less.html" title="fn promql::select::natural_less">natural_<wbr>less</a><span title="Restricted Visibility"> 🔒</span> </dt><dd><code>github.com/facette/natsort.Compare</code>, which <code>sort_by_label</code> uses: digit runs compare as
|
||
integers when both parse, other runs as strings.</dd><dt><a class="fn" href="fn.rank.html" title="fn promql::select::rank">rank</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>The order of <code>a</code> and <code>b</code> for <code>topk</code> (<code>top</code>) or <code>bottomk</code>; NaN ranks last for both.</dd><dt><a class="fn" href="fn.sample_offset.html" title="fn promql::select::sample_offset">sample_<wbr>offset</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Prometheus <code>HashRatioSampler.SampleOffset</code>: the xxHash64 of the labels as <code>stringlabels</code>
|
||
encodes them, each name and value prefixed by its length, over <code>u64::MAX</code>.</dd><dt><a class="fn" href="fn.scalar.html" title="fn promql::select::scalar">scalar</a></dt><dd><code>scalar(v)</code>: the value of the only float sample present at each point, NaN otherwise.</dd><dt><a class="fn" href="fn.single_field.html" title="fn promql::select::single_field">single_<wbr>field</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.sort_instant.html" title="fn promql::select::sort_instant">sort_<wbr>instant</a></dt><dd>Orders the series of an instant result. A range result keeps its order: Prometheus does not
|
||
sort matrices.</dd><dt><a class="fn" href="fn.topk.html" title="fn promql::select::topk">topk</a></dt><dd><code>topk(k, ...)</code> (<code>top</code>) or <code>bottomk(k, ...)</code> with a constant <code>k</code>.</dd><dt><a class="fn" href="fn.topk_at.html" title="fn promql::select::topk_at">topk_at</a></dt><dd><code>topk</code>/<code>bottomk</code> with <code>k</code> evaluated independently at each grid point.</dd><dt><a class="fn" href="fn.validate_topk_parameters.html" title="fn promql::select::validate_topk_parameters">validate_<wbr>topk_<wbr>parameters</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Validates the complete parameter series for Prometheus topk/bottomk/limitk semantics. Values are
|
||
read in place; copying them would be unaccounted memory.</dd><dt><a class="fn" href="fn.value_at.html" title="fn promql::select::value_at">value_<wbr>at</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>The first field’s value of <code>series</code> at grid <code>point</code>; <code>None</code> when the axis does not carry it.</dd></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><dl class="item-table"><dt><a class="type" href="type.GroupKey.html" title="type promql::select::GroupKey">Group<wbr>Key</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Label pairs identifying a group; empty values are absent, as in Prometheus.</dd></dl></section></div></main></body></html> |