Skip to content

Commit

Permalink
minor: support forgotten large_utf8 (#5393)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener authored Feb 25, 2023
1 parent 248d6fc commit 645428f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
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

0 comments on commit 645428f

Please sign in to comment.