Files
greptimedb/query/range_select/plan_rewrite/index.html
2026-05-12 10:47:44 +00:00

9 lines
7.3 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 `plan_rewrite` mod in crate `query`."><title>query::range_select::plan_rewrite - 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-17e0aaed.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="query" data-themes="" data-resource-suffix="" data-rustdoc-version="1.96.0-nightly (ac7f9ec7d 2026-03-20)" data-channel="nightly" data-search-js="search-63369b7b.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-5013f961.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 plan_rewrite</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../query/index.html">query</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module plan_<wbr>rewrite</a></h2><h3><a href="#macros">Module Items</a></h3><ul class="block"><li><a href="#macros" title="Macros">Macros</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In query::<wbr>range_<wbr>select</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">query</a>::<wbr><a href="../index.html">range_select</a></div><h1>Module <span>plan_<wbr>rewrite</span>&nbsp;<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/query/range_select/plan_rewrite.rs.html#15-1177">Source</a> </span></div><h2 id="macros" class="section-header">Macros<a href="#macros" class="anchor">§</a></h2><dl class="item-table"><dt><a class="macro" href="macro.inconsistent_check.html" title="macro query::range_select::plan_rewrite::inconsistent_check">inconsistent_<wbr>check</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt></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.RangeExprRewriter.html" title="struct query::range_select::plan_rewrite::RangeExprRewriter">Range<wbr>Expr<wbr>Rewriter</a></dt><dd><code>RangeExprRewriter</code> will recursively search certain <code>Expr</code>, find all <code>range_fn</code> scalar udf contained in <code>Expr</code>,
and collect the information required by the RangeSelect query,
and finally modify the <code>range_fn</code> scalar udf to an ordinary column field.</dd><dt><a class="struct" href="struct.RangePlanRewriter.html" title="struct query::range_select::plan_rewrite::RangePlanRewriter">Range<wbr>Plan<wbr>Rewriter</a></dt><dd>In order to implement RangeSelect query like <code>avg(field_0) RANGE '5m' FILL NULL</code>,
All RangeSelect query items are converted into udf scalar function in sql parse stage, with format like <code>range_fn(avg(field_0), .....)</code>.
<code>range_fn</code> contains all the parameters we need to execute RangeSelect.
In order to correctly execute the query process of range select, we need to modify the query plan generated by datafusion.
We need to recursively find the entire LogicalPlan, and find all <code>range_fn</code> scalar udf contained in the project plan,
collecting info we need to generate RangeSelect Query LogicalPlan and rewrite th original LogicalPlan.</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.dispose_parse_error.html" title="fn query::range_select::plan_rewrite::dispose_parse_error">dispose_<wbr>parse_<wbr>error</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.evaluate_expr_to_millisecond.html" title="fn query::range_select::plan_rewrite::evaluate_expr_to_millisecond">evaluate_<wbr>expr_<wbr>to_<wbr>millisecond</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Evaluate a time calculation expr, case like:</dd><dt><a class="fn" href="fn.have_range_in_exprs.html" title="fn query::range_select::plan_rewrite::have_range_in_exprs">have_<wbr>range_<wbr>in_<wbr>exprs</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.interval_only_in_expr.html" title="fn query::range_select::plan_rewrite::interval_only_in_expr">interval_<wbr>only_<wbr>in_<wbr>expr</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.parse_align_to.html" title="fn query::range_select::plan_rewrite::parse_align_to">parse_<wbr>align_<wbr>to</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Parse the <code>align to</code> clause and return a UTC timestamp with unit of millisecond,
which is used as the basis for dividing time slot during the align operation.</dd><dt><a class="fn" href="fn.parse_duration_expr.html" title="fn query::range_select::plan_rewrite::parse_duration_expr">parse_<wbr>duration_<wbr>expr</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Parse a duraion expr:</dd><dt><a class="fn" href="fn.parse_expr_list.html" title="fn query::range_select::plan_rewrite::parse_expr_list">parse_<wbr>expr_<wbr>list</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.parse_expr_to_string.html" title="fn query::range_select::plan_rewrite::parse_expr_to_string">parse_<wbr>expr_<wbr>to_<wbr>string</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.parse_str_expr.html" title="fn query::range_select::plan_rewrite::parse_str_expr">parse_<wbr>str_<wbr>expr</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt></dl></section></div></main></body></html>