Skip to content

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
Honeta committed Jun 8, 2023
1 parent 172540c commit 53af7e8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/frontend/src/binder/expr/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,16 @@ impl Binder {
)
};
let direct_args = if matches!(kind, AggKind::PercentileCont | AggKind::PercentileDisc) {
let arg =
let args =
self.bind_function_arg(f.args.into_iter().exactly_one().map_err(|_| {
ErrorCode::InvalidInputSyntax(format!("only one arg is expected in {}", kind))
})?)?;
if arg.len() != 1 || arg[0].clone().as_literal().is_none() {
if args.len() != 1 || args[0].clone().as_literal().is_none() {
Err(
ErrorCode::InvalidInputSyntax(format!("arg in {} must be constant", kind))
.into(),
)
} else if let Ok(casted) = arg[0]
} else if let Ok(casted) = args[0]
.clone()
.cast_implicit(DataType::Float64)?
.fold_const()
Expand Down

0 comments on commit 53af7e8

Please sign in to comment.