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 @@ -12158,6 +12158,43 @@ impl<'a> Parser<'a> {
1215812158 }
1215912159 rewrite_projection
1216012160 } else {
12161+ // `align` not found, report an error if the projection contains `range_fn` but without rewriting them.
12162+
12163+ let align_fill_validate = |expr: &Expr| {
12164+ rewrite_calculation_expr(expr, true, &mut |e: &Expr| match e {
12165+ Expr::Function(func) => {
12166+ if let Some(name) = func.name.0.first() {
12167+ if name.value.as_str() == "range_fn" {
12168+ let FunctionArguments::List(args) = &func.args else {
12169+ unreachable!()
12170+ };
12171+
12172+ if args.args.len() < 5 {
12173+ return Err(ParserError::ParserError(
12174+ "ALIGN argument cannot be omitted in the range select query".into(),
12175+ ));
12176+ }
12177+ }
12178+ }
12179+ Ok(None)
12180+ }
12181+ _ => Ok(None),
12182+ })
12183+ };
12184+
12185+ projection
12186+ .iter()
12187+ .map(|select_item| {
12188+ match select_item {
12189+ SelectItem::UnnamedExpr(expr) => {
12190+ align_fill_validate(expr)?;
12191+ }
12192+ _ => {}
12193+ }
12194+ Ok(())
12195+ })
12196+ .collect::<Result<Vec<()>, ParserError>>()?;
12197+
1216112198 projection
1216212199 };
1216312200
You can’t perform that action at this time.
0 commit comments