alamb commented on code in PR #12133:
URL: https://github.com/apache/datafusion/pull/12133#discussion_r1729223545
##########
datafusion/functions-aggregate/src/approx_percentile_cont.rs:
##########
@@ -154,19 +154,20 @@ fn get_scalar_value(expr: &Arc<dyn PhysicalExpr>) ->
Result<ScalarValue> {
}
fn validate_input_percentile_expr(expr: &Arc<dyn PhysicalExpr>) -> Result<f64>
{
- let percentile = match get_scalar_value(expr)? {
- ScalarValue::Float32(Some(value)) => {
+ let percentile = match get_scalar_value(expr).ok() {
Review Comment:
Another way to express this for your consideration that might make the error
handling more obvious is
```rust
let scalar = match get_scalar_value(expr)
.map_err(not_impl_err!("Percentile value for
'APPROX_PERCENTILE_CONT' must be a litera, got: {expr}l")?
match scalar {
ScalarValue::Float32(Some(value)) => {
...
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]