File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -10508,6 +10508,47 @@ 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+ if let Some(FunctionArg::Unnamed(FunctionArgExpr::Expr(
10522+ Expr::Value(Value::SingleQuotedString(value)),
10523+ ))) = args.args.last()
10524+ {
10525+ if !value.is_empty() {
10526+ return Err(ParserError::ParserError(
10527+ "ALIGN argument cannot be omitted in the range select query".into(),
10528+ ));
10529+ }
10530+ }
10531+ }
10532+ }
10533+ Ok(None)
10534+ }
10535+ _ => Ok(None),
10536+ })
10537+ };
10538+
10539+ projection
10540+ .iter()
10541+ .map(|select_item| {
10542+ match select_item {
10543+ SelectItem::UnnamedExpr(expr) => {
10544+ align_fill_validate(expr)?;
10545+ }
10546+ _ => {}
10547+ }
10548+ Ok(())
10549+ })
10550+ .collect::<Result<Vec<()>, ParserError>>()?;
10551+
1051110552 projection
1051210553 };
1051310554
You can’t perform that action at this time.
0 commit comments