Skip to content

Commit

Permalink
add error for invalid eval mode
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Apr 19, 2024
1 parent 24e739b commit 588bc3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/execution/datafusion/expressions/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use arrow::{
use arrow_array::{Array, ArrayRef, BooleanArray, GenericStringArray, OffsetSizeTrait};
use arrow_schema::{DataType, Schema};
use datafusion::logical_expr::ColumnarValue;
git use datafusion_common::{internal_err, Result as DataFusionResult, ScalarValue};
use datafusion_common::{internal_err, Result as DataFusionResult, ScalarValue};
use datafusion_physical_expr::PhysicalExpr;

use crate::execution::datafusion::expressions::utils::{
Expand Down
7 changes: 6 additions & 1 deletion core/src/execution/datafusion/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,12 @@ impl PhysicalPlanner {
let eval_mode = match expr.eval_mode.as_str() {
"ANSI" => EvalMode::Ansi,
"TRY" => EvalMode::Try,
_ => EvalMode::Legacy,
"LEGACY" => EvalMode::Legacy,
other => {
return Err(ExecutionError::GeneralError(format!(
"Invalid Cast EvalMode: {other}"
)))
}
};
Ok(Arc::new(Cast::new(child, datatype, eval_mode, timezone)))
}
Expand Down

0 comments on commit 588bc3b

Please sign in to comment.