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 @@ -10508,6 +10508,43 @@ impl<'a> Parser<'a> {
1050810508 }
1050910509 rewrite_projection
1051010510 } else {
10511+ // `align` not found, report an error if the projection contains `range_fn` but without rewriting them.
10512+
10513+ let align_fill_validate = |expr: &Expr| {
10514+ rewrite_calculation_expr(expr, true, &mut |e: &Expr| match e {
10515+ Expr::Function(func) => {
10516+ if let Some(name) = func.name.0.first() {
10517+ if name.value.as_str() == "range_fn" {
10518+ let FunctionArguments::List(args) = &func.args else {
10519+ unreachable!()
10520+ };
10521+
10522+ if args.args.len() < 5 {
10523+ return Err(ParserError::ParserError(
10524+ "ALIGN argument cannot be omitted in the range select query".into(),
10525+ ));
10526+ }
10527+ }
10528+ }
10529+ Ok(None)
10530+ }
10531+ _ => Ok(None),
10532+ })
10533+ };
10534+
10535+ projection
10536+ .iter()
10537+ .map(|select_item| {
10538+ match select_item {
10539+ SelectItem::UnnamedExpr(expr) => {
10540+ align_fill_validate(expr)?;
10541+ }
10542+ _ => {}
10543+ }
10544+ Ok(())
10545+ })
10546+ .collect::<Result<Vec<()>, ParserError>>()?;
10547+
1051110548 projection
1051210549 };
1051310550
You can’t perform that action at this time.
0 commit comments