Skip to content

Commit dc64d93

Browse files
committed
Added support for using jiff for parsing timestamps for to_timestamp and to_date.
Jiff specific tests still need to be added.
1 parent cf39ac1 commit dc64d93

15 files changed

Lines changed: 780 additions & 332 deletions

File tree

Cargo.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion/common/src/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,17 @@ config_namespace! {
490490
/// Defaults to the number of CPU cores on the system
491491
pub target_partitions: usize, transform = ExecutionOptions::normalized_parallelism, default = get_available_parallelism()
492492

493+
/// The date time parser to use when parsing date time values.
494+
///
495+
/// Defaults to 'chrono'. 'jiff' is supported when the 'jiff' feature is enabled.
496+
pub date_time_parser: Option<String>, default = Some("chrono".to_string())
497+
493498
/// The default time zone
494499
///
495500
/// Some functions, e.g. `now` return timestamps in this time zone
496501
pub time_zone: Option<String>, default = None
497502

503+
498504
/// Parquet options
499505
pub parquet: ParquetOptions, default = Default::default()
500506

datafusion/core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ unicode_expressions = [
108108
"datafusion-functions/unicode_expressions",
109109
]
110110
extended_tests = []
111+
jiff = ["datafusion-functions/jiff"]
111112

112113
[dependencies]
113114
arrow = { workspace = true }

datafusion/functions/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ default = [
5252
]
5353
# enable encode/decode functions
5454
encoding_expressions = ["base64", "hex"]
55+
# enable jiff timestamp parsing
56+
jiff = ["dep:jiff"]
5557
# enable math functions
5658
math_expressions = []
5759
# enable regular expressions
@@ -71,15 +73,18 @@ base64 = { version = "0.22", optional = true }
7173
blake2 = { version = "^0.10.2", optional = true }
7274
blake3 = { version = "1.8", optional = true }
7375
chrono = { workspace = true }
74-
jiff = "0.2.16"
76+
chrono-tz = "0.10.4"
7577
datafusion-common = { workspace = true }
7678
datafusion-doc = { workspace = true }
7779
datafusion-execution = { workspace = true }
7880
datafusion-expr = { workspace = true }
7981
datafusion-expr-common = { workspace = true }
8082
datafusion-macros = { workspace = true }
83+
dyn-eq = "0.1.3"
84+
dyn-hash = "1.0.0"
8185
hex = { version = "0.4", optional = true }
8286
itertools = { workspace = true }
87+
jiff = { version = "0.2.16", optional = true }
8388
log = { workspace = true }
8489
md-5 = { version = "^0.10.0", optional = true }
8590
num-traits = { workspace = true }

datafusion/functions/benches/to_timestamp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn data() -> StringArray {
3434
"1997-01-31T09:26:56.123Z",
3535
"1997-01-31T09:26:56.123-05:00",
3636
"1997-01-31 09:26:56.123-05:00",
37-
"2023-01-01 04:05:06.789-08:00",
37+
"2023-01-01 04:05:06.789-08",
3838
"1997-01-31T09:26:56.123",
3939
"1997-01-31 09:26:56.123",
4040
"1997-01-31 09:26:56",

0 commit comments

Comments
 (0)