Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions datafusion/expr/src/type_coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ pub fn is_date(dt: &DataType) -> bool {
matches!(dt, DataType::Date32 | DataType::Date64)
}

/// Determine whether the given data type `dt` is a `Utf8`.
pub fn is_utf8(dt: &DataType) -> bool {
matches!(dt, DataType::Utf8)
/// Determine whether the given data type `dt` is a `Utf8` or `LargeUtf8`.
pub fn is_utf8_or_large_utf8(dt: &DataType) -> bool {
matches!(dt, DataType::Utf8 | DataType::LargeUtf8)
}

pub mod aggregates;
Expand Down
6 changes: 4 additions & 2 deletions datafusion/optimizer/src/type_coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ 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, is_utf8};
use datafusion_expr::type_coercion::{
is_date, is_numeric, is_timestamp, is_utf8_or_large_utf8,
};
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 @@ -525,7 +527,7 @@ fn coerce_window_frame(
let target_type = match window_frame.units {
WindowFrameUnits::Range => {
if let Some(col_type) = current_types.first() {
if is_numeric(col_type) || is_utf8(col_type) {
if is_numeric(col_type) || is_utf8_or_large_utf8(col_type) {
col_type
} else if is_timestamp(col_type) || is_date(col_type) {
&DataType::Interval(IntervalUnit::MonthDayNano)
Expand Down