Skip to content

Commit

Permalink
bugfix: fix error when get_coerced_window_frame meet utf8 (#5234)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener authored Feb 10, 2023
1 parent 0a5e8ae commit f2ce2b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions datafusion/expr/src/type_coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ pub fn is_date(dt: &DataType) -> bool {
matches!(dt, DataType::Date32 | DataType::Date64)
}

pub fn is_uft8(dt: &DataType) -> bool {
matches!(dt, DataType::Utf8)
}

pub mod aggregates;
pub mod binary;
pub mod functions;
Expand Down
4 changes: 2 additions & 2 deletions datafusion/optimizer/src/type_coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use datafusion_expr::type_coercion::functions::data_types;
use datafusion_expr::type_coercion::other::{
get_coerce_type_for_case_when, get_coerce_type_for_list,
};
use datafusion_expr::type_coercion::{is_date, is_numeric, is_timestamp};
use datafusion_expr::type_coercion::{is_date, is_numeric, is_timestamp, is_uft8};
use datafusion_expr::utils::from_plan;
use datafusion_expr::{
aggregate_function, function, is_false, is_not_false, is_not_true, is_not_unknown,
Expand Down Expand Up @@ -478,7 +478,7 @@ fn get_coerced_window_frame(
expressions: &[Expr],
) -> Result<WindowFrame> {
fn get_coerced_type(column_type: &DataType) -> Result<DataType> {
if is_numeric(column_type) {
if is_numeric(column_type) | is_uft8(column_type) {
Ok(column_type.clone())
} else if is_timestamp(column_type) || is_date(column_type) {
Ok(DataType::Interval(IntervalUnit::MonthDayNano))
Expand Down

0 comments on commit f2ce2b9

Please sign in to comment.