Skip to content

Apache DataFusion SQL Query Engine

minor: support forgotten large_utf8 (#5393)

jakevin645428f59b83
diff --git a/datafusion/expr/src/type_coercion.rs b/datafusion/expr/src/type_coercion.rs
index ca624a8777..373f4a7a2d 100644
--- a/datafusion/expr/src/type_coercion.rs
+++ b/datafusion/expr/src/type_coercion.rs
@@ -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;
diff --git a/datafusion/optimizer/src/type_coercion.rs b/datafusion/optimizer/src/type_coercion.rs
index a5f99e74ff..4031edcac6 100644
--- a/datafusion/optimizer/src/type_coercion.rs
+++ b/datafusion/optimizer/src/type_coercion.rs
@@ -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,
@@ -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)