mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-13 23:42:32 +00:00
20 lines
22 KiB
HTML
20 lines
22 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="API documentation for the Rust `functions` mod in crate `promql`."><title>promql::functions - 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 functions</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 functions</a></h2><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><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>functions</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/functions.rs.html#15-384">Source</a> </span></div><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="aggr_over_time/index.html" title="mod promql::functions::aggr_over_time">aggr_<wbr>over_<wbr>time</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="mod" href="changes/index.html" title="mod promql::functions::changes">changes</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Implementation of <a href="https://prometheus.io/docs/prometheus/latest/querying/functions/#changes"><code>changes</code></a> in PromQL. Refer to the <a href="https://github.com/prometheus/prometheus/blob/main/promql/functions.go#L1023-L1040">original
|
||
implementation</a>.</dd><dt><a class="mod" href="deriv/index.html" title="mod promql::functions::deriv">deriv</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Implementation of <a href="https://prometheus.io/docs/prometheus/latest/querying/functions/#deriv"><code>deriv</code></a> in PromQL. Refer to the <a href="https://github.com/prometheus/prometheus/blob/90b2f7a540b8a70d8d81372e6692dcbb67ccbaaa/promql/functions.go#L839-L856">original
|
||
implementation</a>.</dd><dt><a class="mod" href="double_exponential_smoothing/index.html" title="mod promql::functions::double_exponential_smoothing">double_<wbr>exponential_<wbr>smoothing</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Implementation of <a href="https://prometheus.io/docs/prometheus/latest/querying/functions/#double_exponential_smoothing"><code>double_exponential_smoothing</code></a> in PromQL. Refer to the <a href="https://github.com/prometheus/prometheus/blob/8dba9163f1e923ec213f0f4d5c185d9648e387f0/promql/functions.go#L299">original
|
||
implementation</a>.</dd><dt><a class="mod" href="edge_count/index.html" title="mod promql::functions::edge_count">edge_<wbr>count</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="mod" href="extrapolate_rate/index.html" title="mod promql::functions::extrapolate_rate">extrapolate_<wbr>rate</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Implementations of <code>rate</code>, <code>increase</code> and <code>delta</code> functions in PromQL.</dd><dt><a class="mod" href="idelta/index.html" title="mod promql::functions::idelta">idelta</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="mod" href="ieee_float/index.html" title="mod promql::functions::ieee_float">ieee_<wbr>float</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>PromQL comparison operators and <code>sqrt()</code>, which follow IEEE 754.</dd><dt><a class="mod" href="native_histogram/index.html" title="mod promql::functions::native_histogram">native_<wbr>histogram</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Native histogram PromQL helpers.</dd><dt><a class="mod" href="predict_linear/index.html" title="mod promql::functions::predict_linear">predict_<wbr>linear</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Implementation of <a href="https://prometheus.io/docs/prometheus/latest/querying/functions/#predict_linear"><code>predict_linear</code></a> in PromQL. Refer to the <a href="https://github.com/prometheus/prometheus/blob/90b2f7a540b8a70d8d81372e6692dcbb67ccbaaa/promql/functions.go#L859-L872">original
|
||
implementation</a>.</dd><dt><a class="mod" href="quantile/index.html" title="mod promql::functions::quantile">quantile</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="mod" href="quantile_aggr/index.html" title="mod promql::functions::quantile_aggr">quantile_<wbr>aggr</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="mod" href="resets/index.html" title="mod promql::functions::resets">resets</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Implementation of <a href="https://prometheus.io/docs/prometheus/latest/querying/functions/#resets"><code>reset</code></a> in PromQL. Refer to the <a href="https://github.com/prometheus/prometheus/blob/90b2f7a540b8a70d8d81372e6692dcbb67ccbaaa/promql/functions.go#L1004-L1021">original
|
||
implementation</a>.</dd><dt><a class="mod" href="round/index.html" title="mod promql::functions::round">round</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="mod" href="vector_matching/index.html" title="mod promql::functions::vector_matching">vector_<wbr>matching</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Cardinality checks for PromQL vector matching.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.AbsentOverTime.html" title="struct promql::functions::AbsentOverTime">Absent<wbr>Over<wbr>Time</a></dt><dd>absent_over_time returns an empty vector if the range vector passed to it has any
|
||
elements (floats or native histograms) and a 1-element vector with the value 1 if
|
||
the range vector passed to it has no elements.</dd><dt><a class="struct" href="struct.AvgOverTime.html" title="struct promql::functions::AvgOverTime">AvgOver<wbr>Time</a></dt><dd>The average value of all points in the specified interval.</dd><dt><a class="struct" href="struct.Changes.html" title="struct promql::functions::Changes">Changes</a></dt><dd>used to count the number of value changes that occur within a specific time range</dd><dt><a class="struct" href="struct.CountOverTime.html" title="struct promql::functions::CountOverTime">Count<wbr>Over<wbr>Time</a></dt><dd>The count of all values in the specified interval.</dd><dt><a class="struct" href="struct.Deriv.html" title="struct promql::functions::Deriv">Deriv</a></dt><dt><a class="struct" href="struct.DoubleExponentialSmoothing.html" title="struct promql::functions::DoubleExponentialSmoothing">Double<wbr>Exponential<wbr>Smoothing</a></dt><dd>There are 3 variants of smoothing functions:</dd><dt><a class="struct" href="struct.IDelta.html" title="struct promql::functions::IDelta">IDelta</a></dt><dd>The <code>funcIdelta</code> in Promql,
|
||
from <a href="https://github.com/prometheus/prometheus/blob/6bdecf377cea8e856509914f35234e948c4fcb80/promql/functions.go#L235">https://github.com/prometheus/prometheus/blob/6bdecf377cea8e856509914f35234e948c4fcb80/promql/functions.go#L235</a></dd><dt><a class="struct" href="struct.IeeeComparison.html" title="struct promql::functions::IeeeComparison">Ieee<wbr>Comparison</a></dt><dd>A PromQL comparison operator on two float operands.</dd><dt><a class="struct" href="struct.IeeeSqrt.html" title="struct promql::functions::IeeeSqrt">Ieee<wbr>Sqrt</a></dt><dd>PromQL <code>sqrt()</code>.</dd><dt><a class="struct" href="struct.LastOverTime.html" title="struct promql::functions::LastOverTime">Last<wbr>Over<wbr>Time</a></dt><dd>The most recent point value in specified interval.</dd><dt><a class="struct" href="struct.MaxOverTime.html" title="struct promql::functions::MaxOverTime">MaxOver<wbr>Time</a></dt><dd>The maximum value of all points in the specified interval.</dd><dt><a class="struct" href="struct.MinOverTime.html" title="struct promql::functions::MinOverTime">MinOver<wbr>Time</a></dt><dd>The minimum value of all points in the specified interval.</dd><dt><a class="struct" href="struct.MixedRange.html" title="struct promql::functions::MixedRange">Mixed<wbr>Range</a></dt><dd>Coordinated float/native-histogram range evaluation.</dd><dt><a class="struct" href="struct.NativeHistogramAbsentOverTime.html" title="struct promql::functions::NativeHistogramAbsentOverTime">Native<wbr>Histogram<wbr>Absent<wbr>Over<wbr>Time</a></dt><dt><a class="struct" href="struct.NativeHistogramAdd.html" title="struct promql::functions::NativeHistogramAdd">Native<wbr>Histogram<wbr>Add</a></dt><dt><a class="struct" href="struct.NativeHistogramAggAvg.html" title="struct promql::functions::NativeHistogramAggAvg">Native<wbr>Histogram<wbr>AggAvg</a></dt><dt><a class="struct" href="struct.NativeHistogramAggSum.html" title="struct promql::functions::NativeHistogramAggSum">Native<wbr>Histogram<wbr>AggSum</a></dt><dt><a class="struct" href="struct.NativeHistogramAvg.html" title="struct promql::functions::NativeHistogramAvg">Native<wbr>Histogram<wbr>Avg</a></dt><dt><a class="struct" href="struct.NativeHistogramAvgOverTime.html" title="struct promql::functions::NativeHistogramAvgOverTime">Native<wbr>Histogram<wbr>AvgOver<wbr>Time</a></dt><dt><a class="struct" href="struct.NativeHistogramChanges.html" title="struct promql::functions::NativeHistogramChanges">Native<wbr>Histogram<wbr>Changes</a></dt><dt><a class="struct" href="struct.NativeHistogramCount.html" title="struct promql::functions::NativeHistogramCount">Native<wbr>Histogram<wbr>Count</a></dt><dt><a class="struct" href="struct.NativeHistogramCountOverTime.html" title="struct promql::functions::NativeHistogramCountOverTime">Native<wbr>Histogram<wbr>Count<wbr>Over<wbr>Time</a></dt><dt><a class="struct" href="struct.NativeHistogramDelta.html" title="struct promql::functions::NativeHistogramDelta">Native<wbr>Histogram<wbr>Delta</a></dt><dt><a class="struct" href="struct.NativeHistogramDivScalar.html" title="struct promql::functions::NativeHistogramDivScalar">Native<wbr>Histogram<wbr>DivScalar</a></dt><dt><a class="struct" href="struct.NativeHistogramDrop.html" title="struct promql::functions::NativeHistogramDrop">Native<wbr>Histogram<wbr>Drop</a></dt><dt><a class="struct" href="struct.NativeHistogramEq.html" title="struct promql::functions::NativeHistogramEq">Native<wbr>Histogram<wbr>Eq</a></dt><dt><a class="struct" href="struct.NativeHistogramFraction.html" title="struct promql::functions::NativeHistogramFraction">Native<wbr>Histogram<wbr>Fraction</a></dt><dt><a class="struct" href="struct.NativeHistogramIDelta.html" title="struct promql::functions::NativeHistogramIDelta">Native<wbr>HistogramI<wbr>Delta</a></dt><dt><a class="struct" href="struct.NativeHistogramIRate.html" title="struct promql::functions::NativeHistogramIRate">Native<wbr>HistogramI<wbr>Rate</a></dt><dt><a class="struct" href="struct.NativeHistogramIncrease.html" title="struct promql::functions::NativeHistogramIncrease">Native<wbr>Histogram<wbr>Increase</a></dt><dt><a class="struct" href="struct.NativeHistogramLastOverTime.html" title="struct promql::functions::NativeHistogramLastOverTime">Native<wbr>Histogram<wbr>Last<wbr>Over<wbr>Time</a></dt><dt><a class="struct" href="struct.NativeHistogramMulScalar.html" title="struct promql::functions::NativeHistogramMulScalar">Native<wbr>Histogram<wbr>MulScalar</a></dt><dt><a class="struct" href="struct.NativeHistogramNeg.html" title="struct promql::functions::NativeHistogramNeg">Native<wbr>Histogram<wbr>Neg</a></dt><dt><a class="struct" href="struct.NativeHistogramNotEq.html" title="struct promql::functions::NativeHistogramNotEq">Native<wbr>Histogram<wbr>NotEq</a></dt><dt><a class="struct" href="struct.NativeHistogramPresentOverTime.html" title="struct promql::functions::NativeHistogramPresentOverTime">Native<wbr>Histogram<wbr>Present<wbr>Over<wbr>Time</a></dt><dt><a class="struct" href="struct.NativeHistogramQuantile.html" title="struct promql::functions::NativeHistogramQuantile">Native<wbr>Histogram<wbr>Quantile</a></dt><dt><a class="struct" href="struct.NativeHistogramRate.html" title="struct promql::functions::NativeHistogramRate">Native<wbr>Histogram<wbr>Rate</a></dt><dt><a class="struct" href="struct.NativeHistogramResets.html" title="struct promql::functions::NativeHistogramResets">Native<wbr>Histogram<wbr>Resets</a></dt><dt><a class="struct" href="struct.NativeHistogramScalarMul.html" title="struct promql::functions::NativeHistogramScalarMul">Native<wbr>Histogram<wbr>Scalar<wbr>Mul</a></dt><dt><a class="struct" href="struct.NativeHistogramStddev.html" title="struct promql::functions::NativeHistogramStddev">Native<wbr>Histogram<wbr>Stddev</a></dt><dt><a class="struct" href="struct.NativeHistogramStdvar.html" title="struct promql::functions::NativeHistogramStdvar">Native<wbr>Histogram<wbr>Stdvar</a></dt><dt><a class="struct" href="struct.NativeHistogramSub.html" title="struct promql::functions::NativeHistogramSub">Native<wbr>Histogram<wbr>Sub</a></dt><dt><a class="struct" href="struct.NativeHistogramSum.html" title="struct promql::functions::NativeHistogramSum">Native<wbr>Histogram<wbr>Sum</a></dt><dt><a class="struct" href="struct.NativeHistogramSumOverTime.html" title="struct promql::functions::NativeHistogramSumOverTime">Native<wbr>Histogram<wbr>SumOver<wbr>Time</a></dt><dt><a class="struct" href="struct.NativeHistogramToString.html" title="struct promql::functions::NativeHistogramToString">Native<wbr>Histogram<wbr>ToString</a></dt><dt><a class="struct" href="struct.PredictLinear.html" title="struct promql::functions::PredictLinear">Predict<wbr>Linear</a></dt><dt><a class="struct" href="struct.PresentOverTime.html" title="struct promql::functions::PresentOverTime">Present<wbr>Over<wbr>Time</a></dt><dd>the value 1 for any series in the specified interval.</dd><dt><a class="struct" href="struct.PromqlFloatToString.html" title="struct promql::functions::PromqlFloatToString">Promql<wbr>Float<wbr>ToString</a></dt><dd>Formats float samples as PromQL label values.</dd><dt><a class="struct" href="struct.QuantileOverTime.html" title="struct promql::functions::QuantileOverTime">Quantile<wbr>Over<wbr>Time</a></dt><dt><a class="struct" href="struct.Resets.html" title="struct promql::functions::Resets">Resets</a></dt><dd>used to count the number of times the time series starts over.</dd><dt><a class="struct" href="struct.Round.html" title="struct promql::functions::Round">Round</a></dt><dt><a class="struct" href="struct.StddevOverTime.html" title="struct promql::functions::StddevOverTime">Stddev<wbr>Over<wbr>Time</a></dt><dd>the population standard deviation of the values in the specified interval.
|
||
Prometheus’s implementation: <a href="https://github.com/prometheus/prometheus/blob/f55ab2217984770aa1eecd0f2d5f54580029b1c0/promql/functions.go#L556-L569">https://github.com/prometheus/prometheus/blob/f55ab2217984770aa1eecd0f2d5f54580029b1c0/promql/functions.go#L556-L569</a></dd><dt><a class="struct" href="struct.StdvarOverTime.html" title="struct promql::functions::StdvarOverTime">Stdvar<wbr>Over<wbr>Time</a></dt><dd>the population standard variance of the values in the specified interval.
|
||
DataFusion’s implementation:
|
||
<a href="https://github.com/apache/arrow-datafusion/blob/292eb954fc0bad3a1febc597233ba26cb60bda3e/datafusion/physical-expr/src/aggregate/variance.rs#L224-#L241">https://github.com/apache/arrow-datafusion/blob/292eb954fc0bad3a1febc597233ba26cb60bda3e/datafusion/physical-expr/src/aggregate/variance.rs#L224-#L241</a></dd><dt><a class="struct" href="struct.SumOverTime.html" title="struct promql::functions::SumOverTime">SumOver<wbr>Time</a></dt><dd>The sum of all values in the specified interval.</dd><dt><a class="struct" href="struct.UniqueMatchGroup.html" title="struct promql::functions::UniqueMatchGroup">Unique<wbr>Match<wbr>Group</a></dt><dd>Rejects a vector matching whose match groups are not unique.</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.MatchGroupViolation.html" title="enum promql::functions::MatchGroupViolation">Match<wbr>Group<wbr>Violation</a></dt><dd>The rule a repeated match group violates.</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.QUANTILE_NAME.html" title="constant promql::functions::QUANTILE_NAME">QUANTILE_<wbr>NAME</a></dt></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.compensated_sum_inc.html" title="fn promql::functions::compensated_sum_inc">compensated_<wbr>sum_<wbr>inc</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>compensation(Kahan) summation algorithm - a technique for reducing the numerical error
|
||
in floating-point arithmetic. The algorithm also includes the modification (“Neumaier improvement”)
|
||
that reduces the numerical error further in cases
|
||
where the numbers being summed have a large difference in magnitude
|
||
Prometheus’s implementation:
|
||
<a href="https://github.com/prometheus/prometheus/blob/f55ab2217984770aa1eecd0f2d5f54580029b1c0/promql/functions.go#L782">https://github.com/prometheus/prometheus/blob/f55ab2217984770aa1eecd0f2d5f54580029b1c0/promql/functions.go#L782</a></dd><dt><a class="fn" href="fn.extract_array.html" title="fn promql::functions::extract_array">extract_<wbr>array</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Extracts an array from a <code>ColumnarValue</code>.</dd><dt><a class="fn" href="fn.extract_range_array.html" title="fn promql::functions::extract_range_array">extract_<wbr>range_<wbr>array</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Extracts a validated <a href="../range_array/struct.RangeArray.html" title="struct promql::range_array::RangeArray">RangeArray</a> from a [ColumnarValue].</dd><dt><a class="fn" href="fn.extract_range_dict.html" title="fn promql::functions::extract_range_dict">extract_<wbr>range_<wbr>dict</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Extracts and validates a range dictionary with the expected value type.</dd><dt><a class="fn" href="fn.linear_regression.html" title="fn promql::functions::linear_regression">linear_<wbr>regression</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>linear_regression performs a least-square linear regression analysis on the
|
||
times and values. It return the slope and intercept based on times and values.
|
||
Prometheus’s implementation: <a href="https://github.com/prometheus/prometheus/blob/90b2f7a540b8a70d8d81372e6692dcbb67ccbaaa/promql/functions.go#L793-L837">https://github.com/prometheus/prometheus/blob/90b2f7a540b8a70d8d81372e6692dcbb67ccbaaa/promql/functions.go#L793-L837</a></dd><dt><a class="fn" href="fn.linear_regression_slice.html" title="fn promql::functions::linear_regression_slice">linear_<wbr>regression_<wbr>slice</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.linear_regression_slices.html" title="fn promql::functions::linear_regression_slices">linear_<wbr>regression_<wbr>slices</a><span title="Restricted Visibility"> 🔒</span> </dt><dt><a class="fn" href="fn.quantile_udaf.html" title="fn promql::functions::quantile_udaf">quantile_<wbr>udaf</a></dt><dd>Create a quantile <code>AggregateUDF</code> for PromQL quantile operator,
|
||
which calculates φ-quantile (0 ≤ φ ≤ 1) over dimensions</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.Delta.html" title="type promql::functions::Delta">Delta</a></dt><dt><a class="type" href="type.Increase.html" title="type promql::functions::Increase">Increase</a></dt><dt><a class="type" href="type.Rate.html" title="type promql::functions::Rate">Rate</a></dt></dl></section></div></main></body></html> |