File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -10508,6 +10508,48 @@ impl<'a> Parser<'a> {
1050810508 }
1050910509 rewrite_projection
1051010510 } else {
10511+ // `align` not found, validate `range_fn`, report an error if it contains `fill`.
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 let Some(FunctionArg::Unnamed(FunctionArgExpr::Expr(
10523+ Expr::Value(Value::SingleQuotedString(value)),
10524+ ))) = args.args.get(2)
10525+ {
10526+ if !value.is_empty() {
10527+ return Err(ParserError::ParserError(
10528+ "ALIGN argument cannot be omitted in the range select query".into(),
10529+ ));
10530+ }
10531+ }
10532+ }
10533+ }
10534+ Ok(None)
10535+ }
10536+ _ => Ok(None),
10537+ })
10538+ };
10539+
10540+ projection
10541+ .iter()
10542+ .map(|select_item| {
10543+ match select_item {
10544+ SelectItem::UnnamedExpr(expr) => {
10545+ align_fill_validate(expr)?;
10546+ }
10547+ _ => {}
10548+ }
10549+ Ok(())
10550+ })
10551+ .collect::<Result<Vec<()>, ParserError>>()?;
10552+
1051110553 projection
1051210554 };
1051310555
You can’t perform that action at this time.
0 commit comments