Skip to content

Commit

Permalink
refactor: replace map..concat with flat_map
Browse files Browse the repository at this point in the history
  • Loading branch information
appletreeisyellow committed Jul 9, 2024
1 parent 043c997 commit 5fe18d5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions datafusion/functions/src/datetime/to_local_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,16 @@ impl Default for ToLocalTimeFunc {
impl ToLocalTimeFunc {
pub fn new() -> Self {
let base_sig = |array_type: TimeUnit| {
vec![
[
Exact(vec![Timestamp(array_type, None)]),
Exact(vec![Timestamp(array_type, Some(TIMEZONE_WILDCARD.into()))]),
]
};

let full_sig = [Nanosecond, Microsecond, Millisecond, Second]
.into_iter()
.map(base_sig)
.collect::<Vec<_>>()
.concat();
.flat_map(base_sig)
.collect::<Vec<_>>();

Self {
signature: Signature::one_of(full_sig, Volatility::Immutable),
Expand Down

0 comments on commit 5fe18d5

Please sign in to comment.