File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -11027,6 +11027,43 @@ impl<'a> Parser<'a> {
1102711027 }
1102811028 rewrite_projection
1102911029 } else {
11030+ // `align` not found, report an error if the projection contains `range_fn` but without rewriting them.
11031+
11032+ let align_fill_validate = |expr: &Expr| {
11033+ rewrite_calculation_expr(expr, true, &mut |e: &Expr| match e {
11034+ Expr::Function(func) => {
11035+ if let Some(name) = func.name.0.first() {
11036+ if name.value.as_str() == "range_fn" {
11037+ let FunctionArguments::List(args) = &func.args else {
11038+ unreachable!()
11039+ };
11040+
11041+ if args.args.len() < 5 {
11042+ return Err(ParserError::ParserError(
11043+ "ALIGN argument cannot be omitted in the range select query".into(),
11044+ ));
11045+ }
11046+ }
11047+ }
11048+ Ok(None)
11049+ }
11050+ _ => Ok(None),
11051+ })
11052+ };
11053+
11054+ projection
11055+ .iter()
11056+ .map(|select_item| {
11057+ match select_item {
11058+ SelectItem::UnnamedExpr(expr) => {
11059+ align_fill_validate(expr)?;
11060+ }
11061+ _ => {}
11062+ }
11063+ Ok(())
11064+ })
11065+ .collect::<Result<Vec<()>, ParserError>>()?;
11066+
1103011067 projection
1103111068 };
1103211069
You can’t perform that action at this time.
0 commit comments