Skip to content

Commit 3654e18

Browse files
committed
fix copilot
1 parent 900634b commit 3654e18

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

datafusion/functions/src/math/ceil.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,10 @@ impl ScalarUDFImpl for CeilFunc {
192192

193193
fn evaluate_bounds(&self, inputs: &[&Interval]) -> Result<Interval> {
194194
let [input] = inputs else {
195-
let data_type = inputs
196-
.first()
197-
.map(|i| i.data_type())
198-
.unwrap_or(DataType::Float64);
199-
return Interval::make_unbounded(&data_type);
195+
return exec_err!(
196+
"ceil expected 1 argument for bounds evaluation, got {}",
197+
inputs.len()
198+
);
200199
};
201200
let data_type = input.data_type();
202201
match (ceil_scalar(input.lower()), ceil_scalar(input.upper())) {
@@ -212,7 +211,10 @@ impl ScalarUDFImpl for CeilFunc {
212211
inputs: &[&Interval],
213212
) -> Result<Option<Vec<Interval>>> {
214213
let [input_interval] = inputs else {
215-
return Ok(Some(inputs.iter().map(|i| (*i).clone()).collect()));
214+
return exec_err!(
215+
"ceil expected 1 argument for constraint propagation, got {}",
216+
inputs.len()
217+
);
216218
};
217219
// ceil(x) ∈ [N, M] → x ∈ (N−1, M] — conservative closed: [N−1, M]
218220
let lo = match interval.lower() {

datafusion/physical-expr/src/intervals/utils.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ use crate::{
2828
use arrow::array::types::{IntervalDayTime, IntervalMonthDayNano};
2929
use arrow::datatypes::{DataType, SchemaRef};
3030
use datafusion_common::{Result, ScalarValue, internal_err};
31-
use datafusion_expr::Operator;
3231
use datafusion_expr::interval_arithmetic::Interval;
32+
use datafusion_expr::{Operator, Volatility};
3333

3434
/// Indicates whether interval arithmetic is supported for the given expression.
3535
/// Currently, we do not support all [`PhysicalExpr`]s for interval calculations.
@@ -58,7 +58,8 @@ pub fn check_support(expr: &Arc<dyn PhysicalExpr>, schema: &SchemaRef) -> bool {
5858
} else if let Some(negative) = expr.downcast_ref::<NegativeExpr>() {
5959
check_support(negative.arg(), schema)
6060
} else if let Some(scalar_fn) = expr.downcast_ref::<ScalarFunctionExpr>() {
61-
is_datatype_supported(scalar_fn.return_type())
61+
scalar_fn.fun().signature().volatility == Volatility::Immutable
62+
&& is_datatype_supported(scalar_fn.return_type())
6263
&& scalar_fn
6364
.args()
6465
.iter()
@@ -265,9 +266,6 @@ mod tests {
265266
}
266267

267268
impl ScalarUDFImpl for Utf8UDF {
268-
fn as_any(&self) -> &dyn std::any::Any {
269-
self
270-
}
271269
fn name(&self) -> &str {
272270
"utf8_udf"
273271
}

0 commit comments

Comments
 (0)