MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / try_extract_time_bucket

Function try_extract_time_bucket

nodedb-sql/src/planner/aggregate.rs:155–172  ·  view source on GitHub ↗

Check if an expression is a time_bucket() call and extract the interval.

(expr: &ast::Expr, functions: &FunctionRegistry)

Source from the content-addressed store, hash-verified

153
154/// Check if an expression is a time_bucket() call and extract the interval.
155fn try_extract_time_bucket(expr: &ast::Expr, functions: &FunctionRegistry) -> Result<Option<i64>> {
156 if let ast::Expr::Function(func) = expr {
157 let name = func
158 .name
159 .0
160 .iter()
161 .map(|p| match p {
162 ast::ObjectNamePart::Identifier(ident) => normalize_ident(ident),
163 _ => String::new(),
164 })
165 .collect::<Vec<_>>()
166 .join(".");
167 if functions.search_trigger(&name) == SearchTrigger::TimeBucket {
168 return Ok(Some(extract_bucket_interval(func)?));
169 }
170 }
171 Ok(None)
172}
173
174/// Resolve a GROUP BY expression that references a SELECT alias or ordinal.
175///

Calls 5

normalize_identFunction · 0.85
extract_bucket_intervalFunction · 0.85
joinMethod · 0.80
search_triggerMethod · 0.80
iterMethod · 0.45