Skip to content
Closed
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
1 change: 1 addition & 0 deletions datafusion/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub mod scalar;
pub mod spans;
pub mod stats;
pub mod test_util;
pub mod timezone_cast;
pub mod tree_node;
pub mod types;
pub mod utils;
Expand Down
12 changes: 12 additions & 0 deletions datafusion/common/src/scalar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4440,6 +4440,18 @@ impl ScalarValue {
target_type,
) {
crate::nested_struct::cast_column(&scalar_array, target_type, cast_options)?
} else if crate::timezone_cast::is_naive_to_timezone_cast(
&source_type,
target_type,
) {
// Casting a timezone-naive timestamp into a timezone follows
// PostgreSQL/DuckDB semantics around daylight saving transitions,
// which differ from arrow's kernel.
crate::timezone_cast::cast_naive_timestamp_to_timezone(
&scalar_array,
target_type,
cast_options,
)?
} else {
cast_with_options(&scalar_array, target_type, cast_options)?
};
Expand Down
Loading