From 79bc4bf5c5acac20d697540fec9d6bc74892b943 Mon Sep 17 00:00:00 2001 From: Erik Bogado Date: Mon, 9 Nov 2026 17:19:28 -0300 Subject: [PATCH 1/8] fix: accept second-precision zone offsets in native timestamp casts --- .../spark-expr/src/conversion_funcs/string.rs | 122 +++++++++++++++--- 1 file changed, 102 insertions(+), 20 deletions(-) diff --git a/native/spark-expr/src/conversion_funcs/string.rs b/native/spark-expr/src/conversion_funcs/string.rs index 981cc0e5ced..222978651f4 100644 --- a/native/spark-expr/src/conversion_funcs/string.rs +++ b/native/spark-expr/src/conversion_funcs/string.rs @@ -1538,7 +1538,7 @@ fn timestamp_parser( // base pattern. This prevents the '-' in plain date strings like "2015-03-18" // from being misidentified as a negative-offset sign. if pattern.is_none() { - if let Some((stripped, suffix_tz)) = extract_offset_suffix(value) { + if let Some((stripped, suffix_tz, residual_secs)) = extract_offset_suffix(value) { // Spark applies Java String.trim to the zone, not Unicode whitespace trimming. let stripped = stripped.trim_end_matches(|c: char| c <= '\u{20}'); // A zone suffix is only meaningful after the seconds segment. Otherwise fall @@ -1546,7 +1546,12 @@ fn timestamp_parser( // reported as malformed (null, or CAST_INVALID_INPUT under ANSI) like Spark does. let stripped_pattern = classify_timestamp_pattern(stripped); if stripped_pattern.is_some_and(TimestampPattern::ends_with_seconds_segment) { - return parse_timestamp_pattern(stripped, stripped_pattern, eval_mode, &suffix_tz); + let parsed = + parse_timestamp_pattern(stripped, stripped_pattern, eval_mode, &suffix_tz)?; + // Arrow's `Tz` holds whole minutes, so an offset such as `+08:00:30` arrives as + // the `+08:00` zone plus a 30-second residual. Subtract the residual to land on + // the exact instant Spark computes. + return Ok(parsed.map(|micros| micros - i64::from(residual_secs) * 1_000_000)); } } } @@ -1558,16 +1563,19 @@ fn timestamp_parser( /// full bare +/- offset including its sign character). Returns the offset in whole seconds, /// or `None` for any malformed, out-of-range, or trailing-garbage input. /// -/// Accepted formats (H = 1–2 digit hour, M = 1–2 digit minute): +/// Accepted formats (H = 1–2 digit hour, M = 1–2 digit minute, S = 1–2 digit second): /// "" -> 0 (bare "UTC" / "GMT" / "UT") /// "+H" -> +H*3600 (hour-only, e.g. "+0" from "UTC+0") /// "+HH" -> same /// "+HHMM" -> +H*3600+M*60 (4 digits, no colon) /// "+H:M" -> same (with colon, any digit count 1-2 each) /// "+HH:MM" -> same +/// "+H:M:S" -> +H*3600+M*60+S (Java's `ZoneOffset.of` accepts the seconds form) +/// "+HH:MM:SS" -> same +/// "+HHMMSS" -> same (6 digits, no colon) /// (negative with '-' analogously) /// -/// Hours must be 0–18 and minutes 0–59, with a maximum absolute offset of 18:00. +/// Hours must be 0–18, minutes and seconds 0–59, with a maximum absolute offset of 18:00. /// A trailing colon ("+8:") is rejected. fn parse_sign_offset(s: &str) -> Option { if s.is_empty() { @@ -1583,30 +1591,55 @@ fn parse_sign_offset(s: &str) -> Option { if rest.is_empty() || !rest.bytes().all(|b| b.is_ascii_digit() || b == b':') { return None; } - let (h, m) = if let Some(colon_pos) = rest.find(':') { + let (h, m, sec) = if let Some(colon_pos) = rest.find(':') { let h_str = &rest[..colon_pos]; - let m_str = &rest[colon_pos + 1..]; - if !(1..=2).contains(&h_str.len()) || !(1..=2).contains(&m_str.len()) { + let tail = &rest[colon_pos + 1..]; + if !(1..=2).contains(&h_str.len()) { return None; } let h: i32 = h_str.parse().ok()?; - // Note: "+HH:MM:SS" (with seconds) is not handled; Spark accepts it but it is rare. + // Either "+HH:MM" or "+HH:MM:SS"; each segment is one or two digits. + let (m_str, s_str) = match tail.find(':') { + Some(second_colon) => (&tail[..second_colon], Some(&tail[second_colon + 1..])), + None => (tail, None), + }; + if !(1..=2).contains(&m_str.len()) { + return None; + } let m: i32 = m_str.parse().ok()?; - (h, m) + let sec: i32 = match s_str { + Some(s_str) => { + if !(1..=2).contains(&s_str.len()) { + return None; + } + s_str.parse().ok()? + } + None => 0, + }; + (h, m, sec) } else { match rest.len() { - 1 | 2 => (rest.parse::().ok()?, 0), + 1 | 2 => (rest.parse::().ok()?, 0, 0), 4 => ( rest[..2].parse::().ok()?, rest[2..].parse::().ok()?, + 0, + ), + 6 => ( + rest[..2].parse::().ok()?, + rest[2..4].parse::().ok()?, + rest[4..].parse::().ok()?, ), _ => return None, } }; - if !(0..=18).contains(&h) || !(0..=59).contains(&m) || (h == 18 && m != 0) { + if !(0..=18).contains(&h) || !(0..=59).contains(&m) || !(0..=59).contains(&sec) { + return None; + } + if h == 18 && (m != 0 || sec != 0) { return None; } - Some(sign * (h * 3600 + m * 60)) + Some(sign * (h * 3600 + m * 60 + sec)) } /// Constructs a [`Tz`] from an offset measured in seconds. @@ -1619,6 +1652,14 @@ fn tz_from_offset_secs(secs: i32) -> Option { Tz::from_str(&format!("{}{:02}:{:02}", sign, h, m)).ok() } +/// Splits an offset into the minute-precision [`Tz`] arrow can represent and the residual +/// seconds it cannot carry. `tz_from_offset_secs` truncates toward zero, so the residual keeps +/// the sign of the offset and applying both parts in turn reproduces the exact offset. +fn tz_and_residual_secs(secs: i32) -> Option<(Tz, i32)> { + let tz = tz_from_offset_secs(secs)?; + Some((tz, secs - (secs / 60) * 60)) +} + /// Returns the last (rightmost) byte position where `needle` starts inside `haystack`. fn rfind_str(haystack: &str, needle: &str) -> Option { let hb = haystack.as_bytes(); @@ -1631,9 +1672,13 @@ fn rfind_str(haystack: &str, needle: &str) -> Option { .find(|&i| hb[i..].starts_with(nb)) } -/// If `value` ends with a recognised timezone suffix, returns `(datetime_prefix, Tz)`. +/// If `value` ends with a recognised timezone suffix, returns +/// `(datetime_prefix, Tz, residual_seconds)`. /// Returns `None` when no suffix is found. /// +/// The [`Tz`] carries only whole minutes, so a suffix such as `+08:00:30` is returned as the +/// `+08:00` zone plus a 30-second residual the caller subtracts after parsing. +/// /// Recognised forms (in matching priority order): /// Z -> UTC+0 /// UTC / " UTC" -> UTC+0 (or UTC +/- offset, e.g. "UTC+0", " UTC+07:30") @@ -1644,10 +1689,10 @@ fn rfind_str(haystack: &str, needle: &str) -> Option { /// /// **The caller must ensure the value does not already match a base timestamp pattern.** /// Without that guard a bare '-' in "2015-03-18" would be misread as a -18:00 offset. -fn extract_offset_suffix(value: &str) -> Option<(&str, Tz)> { +fn extract_offset_suffix(value: &str) -> Option<(&str, Tz, i32)> { // 1. Z suffix if let Some(stripped) = value.strip_suffix('Z') { - return Some((stripped, tz_from_offset_secs(0)?)); + return Some((stripped, tz_from_offset_secs(0)?, 0)); } // 2. Named text-prefix forms: "UTC", "GMT", "UT" (optionally space-prefixed), @@ -1657,7 +1702,8 @@ fn extract_offset_suffix(value: &str) -> Option<(&str, Tz)> { if let Some(pos) = rfind_str(value, prefix) { let offset_str = &value[pos + prefix.len()..]; if let Some(secs) = parse_sign_offset(offset_str) { - return Some((&value[..pos], tz_from_offset_secs(secs)?)); + let (tz, residual_secs) = tz_and_residual_secs(secs)?; + return Some((&value[..pos], tz, residual_secs)); } } } @@ -1678,7 +1724,8 @@ fn extract_offset_suffix(value: &str) -> Option<(&str, Tz)> { ] { if let Some(pos) = rfind_str(value, abbr) { if pos + abbr.len() == value.len() { - return Some((&value[..pos], tz_from_offset_secs(*offset_secs)?)); + let (tz, residual_secs) = tz_and_residual_secs(*offset_secs)?; + return Some((&value[..pos], tz, residual_secs)); } } } @@ -1689,7 +1736,7 @@ fn extract_offset_suffix(value: &str) -> Option<(&str, Tz)> { let tz_name = &value[space_pos + 1..]; if tz_name.contains('/') { if let Ok(tz) = Tz::from_str(tz_name) { - return Some((&value[..space_pos], tz)); + return Some((&value[..space_pos], tz, 0)); } } } @@ -1707,7 +1754,8 @@ fn extract_offset_suffix(value: &str) -> Option<(&str, Tz)> { if let Some(pos) = last_sign { let offset_str = &value[pos..]; if let Some(secs) = parse_sign_offset(offset_str) { - return Some((&value[..pos], tz_from_offset_secs(secs)?)); + let (tz, residual_secs) = tz_and_residual_secs(secs)?; + return Some((&value[..pos], tz, residual_secs)); } } @@ -2018,7 +2066,7 @@ fn timestamp_ntz_parser( // pattern matches, so the inner parser reports it as malformed. let (value_to_parse, pattern) = if pattern.is_none() { match extract_offset_suffix(value) { - Some((stripped, _tz)) => { + Some((stripped, _, _residual_secs)) => { // Spark applies Java String.trim to the zone, not Unicode whitespace trimming. let stripped = stripped.trim_end_matches(|c: char| c <= '\u{20}'); let stripped_pattern = classify_timestamp_pattern(stripped); @@ -4240,6 +4288,12 @@ mod tests { ("-18:00", -64_800), ("+1800", 64_800), ("-1800", -64_800), + ("+08:00:30", 28_830), + ("+8:0:3", 28_803), + ("-01:30:15", -5_415), + ("+080030", 28_830), + ("+180000", 64_800), + ("-180000", -64_800), ] { assert_eq!(parse_sign_offset(input), Some(seconds), "{input:?}"); } @@ -4252,6 +4306,11 @@ mod tests { "+19", "-1900", "+8:", + "+08:00:", + "+08:00:60", + "+08:000:30", + "+18:00:01", + "+0800 30", "+1:+1", "-1:-1", "+1\u{967}", @@ -4263,6 +4322,29 @@ mod tests { } } + #[test] + #[cfg_attr(miri, ignore)] + fn timestamp_parser_applies_second_precision_zone_offsets() { + let tz = &Tz::from_str("UTC").unwrap(); + for mode in [EvalMode::Legacy, EvalMode::Try, EvalMode::Ansi] { + // 2020-01-01 12:34:56 at +08:00:30 is 04:34:26 UTC. + assert_eq!( + timestamp_parser("2020-01-01 12:34:56 +08:00:30", mode, tz, true).unwrap(), + Some(1_577_853_266_000_000) + ); + // -01:30:15 is 14:05:11 UTC. + assert_eq!( + timestamp_parser("2020-01-01 12:34:56 -01:30:15", mode, tz, true).unwrap(), + Some(1_577_887_511_000_000) + ); + // TIMESTAMP_NTZ keeps the wall-clock time and only drops the zone. + assert_eq!( + timestamp_ntz_parser("2020-01-01 12:34:56 +08:00:30", mode, true, true).unwrap(), + Some(1_577_882_096_000_000) + ); + } + } + #[test] #[cfg_attr(miri, ignore)] fn timestamp_parser_spark_segment_rules_test() { From 53810a414235e5abf69860fd74e5f0b6562145d2 Mon Sep 17 00:00:00 2001 From: Erik Bogado Date: Mon, 9 Nov 2026 17:59:16 -0300 Subject: [PATCH 2/8] test: cover second-precision zone offsets end to end --- .../test/scala/org/apache/comet/CometNativeCastSuite.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spark/src/test/scala/org/apache/comet/CometNativeCastSuite.scala b/spark/src/test/scala/org/apache/comet/CometNativeCastSuite.scala index 29ddba35457..319e3365c2b 100644 --- a/spark/src/test/scala/org/apache/comet/CometNativeCastSuite.scala +++ b/spark/src/test/scala/org/apache/comet/CometNativeCastSuite.scala @@ -1866,6 +1866,10 @@ class CometNativeCastSuite "2020-01-01T12:34:56-08:00", // Single-digit hour offset (extract_offset_suffix supports ±H:MM) "2020-01-01T12:34:56+5:30", + // Second-precision offsets, the forms Java's ZoneOffset.of accepts + "2020-01-01T12:34:56+08:00:30", + "2020-01-01T12:34:56-01:30:15", + "2020-01-01T12:34:56+080030", // T-prefixed time-only with colon "T12:34", "T12:34:56", @@ -1959,6 +1963,8 @@ class CometNativeCastSuite "2020-06-15T12:30:00+05:30", "2020-06-15T12:30:00-08:00", "2020-06-15T12:30:00 UTC", + "2020-06-15T12:30:00+08:00:30", + "2020-06-15T12:30:00-01:30:15", "2024-03-10 02:30:00", "2024-11-03 01:30:00", "not a timestamp", From 703fdea9983d9da34e06d3d593b67a9c00d522e4 Mon Sep 17 00:00:00 2001 From: Erik Bogado Date: Mon, 9 Nov 2026 18:40:47 -0300 Subject: [PATCH 3/8] fix: match Spark's second-precision offset layouts and guard the residual --- .../spark-expr/src/conversion_funcs/string.rs | 67 +++++++++++++++---- .../apache/comet/CometNativeCastSuite.scala | 2 + 2 files changed, 56 insertions(+), 13 deletions(-) diff --git a/native/spark-expr/src/conversion_funcs/string.rs b/native/spark-expr/src/conversion_funcs/string.rs index 222978651f4..80017843d63 100644 --- a/native/spark-expr/src/conversion_funcs/string.rs +++ b/native/spark-expr/src/conversion_funcs/string.rs @@ -1550,8 +1550,21 @@ fn timestamp_parser( parse_timestamp_pattern(stripped, stripped_pattern, eval_mode, &suffix_tz)?; // Arrow's `Tz` holds whole minutes, so an offset such as `+08:00:30` arrives as // the `+08:00` zone plus a 30-second residual. Subtract the residual to land on - // the exact instant Spark computes. - return Ok(parsed.map(|micros| micros - i64::from(residual_secs) * 1_000_000)); + // the exact instant Spark computes. An instant pushed below the representable + // range is out of range, which Spark reports like any other invalid value. + let adjusted = parsed + .and_then(|micros| micros.checked_sub(i64::from(residual_secs) * 1_000_000)); + return match adjusted { + Some(micros) => Ok(Some(micros)), + None if eval_mode == EvalMode::Ansi => { + Err(SparkError::InvalidInputInCastToDatetime { + value: value.to_string(), + from_type: "STRING".to_string(), + to_type: "TIMESTAMP".to_string(), + }) + } + None => Ok(None), + }; } } } @@ -1570,7 +1583,7 @@ fn timestamp_parser( /// "+HHMM" -> +H*3600+M*60 (4 digits, no colon) /// "+H:M" -> same (with colon, any digit count 1-2 each) /// "+HH:MM" -> same -/// "+H:M:S" -> +H*3600+M*60+S (Java's `ZoneOffset.of` accepts the seconds form) +/// "+H:MM:SS" -> +H*3600+M*60+S (the hour may be short, the minute and second may not) /// "+HH:MM:SS" -> same /// "+HHMMSS" -> same (6 digits, no colon) /// (negative with '-' analogously) @@ -1598,23 +1611,26 @@ fn parse_sign_offset(s: &str) -> Option { return None; } let h: i32 = h_str.parse().ok()?; - // Either "+HH:MM" or "+HH:MM:SS"; each segment is one or two digits. + // Either "+HH:MM" or "+HH:MM:SS". Spark normalizes a one-digit hour or a one-digit + // final minute segment before calling `ZoneId.of`, but not when a seconds segment + // follows, so only the hour may stay short once seconds are present. let (m_str, s_str) = match tail.find(':') { Some(second_colon) => (&tail[..second_colon], Some(&tail[second_colon + 1..])), None => (tail, None), }; - if !(1..=2).contains(&m_str.len()) { - return None; - } - let m: i32 = m_str.parse().ok()?; - let sec: i32 = match s_str { + let (m, sec) = match s_str { Some(s_str) => { - if !(1..=2).contains(&s_str.len()) { + if m_str.len() != 2 || s_str.len() != 2 { return None; } - s_str.parse().ok()? + (m_str.parse().ok()?, s_str.parse().ok()?) + } + None => { + if !(1..=2).contains(&m_str.len()) { + return None; + } + (m_str.parse().ok()?, 0) } - None => 0, }; (h, m, sec) } else { @@ -4289,7 +4305,7 @@ mod tests { ("+1800", 64_800), ("-1800", -64_800), ("+08:00:30", 28_830), - ("+8:0:3", 28_803), + ("+8:00:30", 28_830), ("-01:30:15", -5_415), ("+080030", 28_830), ("+180000", 64_800), @@ -4308,6 +4324,10 @@ mod tests { "+8:", "+08:00:", "+08:00:60", + "+8:0:3", + "+8:0:30", + "+08:0:30", + "+08:00:3", "+08:000:30", "+18:00:01", "+0800 30", @@ -4322,6 +4342,27 @@ mod tests { } } + #[test] + #[cfg_attr(miri, ignore)] + fn timestamp_parser_rejects_residual_offset_underflow() { + let tz = &Tz::from_str("UTC").unwrap(); + // `i64::MIN` microseconds is the earliest representable instant, so a positive residual + // pushes it out of range. Spark returns null there instead of wrapping. + for mode in [EvalMode::Legacy, EvalMode::Try] { + assert_eq!( + timestamp_parser("-290308-12-21T19:59:05.224192+00:00:30", mode, tz, true).unwrap(), + None + ); + } + assert!(timestamp_parser( + "-290308-12-21T19:59:05.224192+00:00:30", + EvalMode::Ansi, + tz, + true + ) + .is_err()); + } + #[test] #[cfg_attr(miri, ignore)] fn timestamp_parser_applies_second_precision_zone_offsets() { diff --git a/spark/src/test/scala/org/apache/comet/CometNativeCastSuite.scala b/spark/src/test/scala/org/apache/comet/CometNativeCastSuite.scala index 319e3365c2b..607b9b39184 100644 --- a/spark/src/test/scala/org/apache/comet/CometNativeCastSuite.scala +++ b/spark/src/test/scala/org/apache/comet/CometNativeCastSuite.scala @@ -1870,6 +1870,8 @@ class CometNativeCastSuite "2020-01-01T12:34:56+08:00:30", "2020-01-01T12:34:56-01:30:15", "2020-01-01T12:34:56+080030", + // Spark rejects a short minute or second segment once seconds are present + "2020-01-01T12:34:56+8:0:3", // T-prefixed time-only with colon "T12:34", "T12:34:56", From 977f4aafc8db3ffe7435a1fba84675b1050ea828 Mon Sep 17 00:00:00 2001 From: Erik Bogado Date: Tue, 10 Nov 2026 08:18:08 -0300 Subject: [PATCH 4/8] style: apply rustfmt to the merged parser tests --- native/spark-expr/src/conversion_funcs/string.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/native/spark-expr/src/conversion_funcs/string.rs b/native/spark-expr/src/conversion_funcs/string.rs index 973aded4768..51e69e48fd9 100644 --- a/native/spark-expr/src/conversion_funcs/string.rs +++ b/native/spark-expr/src/conversion_funcs/string.rs @@ -3712,9 +3712,18 @@ mod tests { Some(utc - 5 * hour - 30 * 60 * 1_000_000), ), // A non-zero seconds part is applied as a residual after the minute-precision zone - ("2020-01-01 12:34:56 +080030", Some(utc - 8 * hour - 30 * 1_000_000)), - ("2020-01-01 12:34:56 +08:00:30", Some(utc - 8 * hour - 30 * 1_000_000)), - ("2020-01-01 12:34:56-01:30:15", Some(utc + hour + 30 * 60 * 1_000_000 + 15 * 1_000_000)), + ( + "2020-01-01 12:34:56 +080030", + Some(utc - 8 * hour - 30 * 1_000_000), + ), + ( + "2020-01-01 12:34:56 +08:00:30", + Some(utc - 8 * hour - 30 * 1_000_000), + ), + ( + "2020-01-01 12:34:56-01:30:15", + Some(utc + hour + 30 * 60 * 1_000_000 + 15 * 1_000_000), + ), ("2020-01-01 12:34:56 +08000", None), // UTC/GMT/UT names, and region ids with those names after a '/' ("2020-01-01 12:34:56 UTC", Some(utc)), From b15086312448b2147fd6265d16e73990b880102f Mon Sep 17 00:00:00 2001 From: Erik Bogado Date: Wed, 11 Nov 2026 11:53:39 -0300 Subject: [PATCH 5/8] refactor: share the timestamp cast invalid-input error --- .../spark-expr/src/conversion_funcs/string.rs | 42 +++++++------------ .../apache/comet/CometNativeCastSuite.scala | 1 + 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/native/spark-expr/src/conversion_funcs/string.rs b/native/spark-expr/src/conversion_funcs/string.rs index 51e69e48fd9..51361ee833c 100644 --- a/native/spark-expr/src/conversion_funcs/string.rs +++ b/native/spark-expr/src/conversion_funcs/string.rs @@ -1518,15 +1518,7 @@ fn timestamp_parser( // padding is accepted there. // Check the prefix, not the base patterns: a zone suffix can hide a time-only match. if trimmed.is_empty() || (is_spark4_plus && start > 0 && trimmed.starts_with('T')) { - return if eval_mode == EvalMode::Ansi { - Err(SparkError::InvalidInputInCastToDatetime { - value: value.to_string(), - from_type: "STRING".to_string(), - to_type: "TIMESTAMP".to_string(), - }) - } else { - Ok(None) - }; + return invalid_timestamp(value, eval_mode); } let value = trimmed; @@ -1556,14 +1548,7 @@ fn timestamp_parser( .and_then(|micros| micros.checked_sub(i64::from(residual_secs) * 1_000_000)); return match adjusted { Some(micros) => Ok(Some(micros)), - None if eval_mode == EvalMode::Ansi => { - Err(SparkError::InvalidInputInCastToDatetime { - value: value.to_string(), - from_type: "STRING".to_string(), - to_type: "TIMESTAMP".to_string(), - }) - } - None => Ok(None), + None => invalid_timestamp(value, eval_mode), }; } } @@ -2087,15 +2072,7 @@ fn parse_timestamp_pattern( }; if timestamp.is_none() { - return if eval_mode == EvalMode::Ansi { - Err(SparkError::InvalidInputInCastToDatetime { - value: value.to_string(), - from_type: "STRING".to_string(), - to_type: "TIMESTAMP".to_string(), - }) - } else { - Ok(None) - }; + return invalid_timestamp(value, eval_mode); } Ok(timestamp) @@ -2147,6 +2124,19 @@ fn timestamp_ntz_parser( timestamp_ntz_parser_inner(value_to_parse, pattern, eval_mode) } +/// ANSI mode raises on an unparseable TIMESTAMP value; the other modes return null. +fn invalid_timestamp(value: &str, eval_mode: EvalMode) -> SparkResult> { + if eval_mode == EvalMode::Ansi { + Err(SparkError::InvalidInputInCastToDatetime { + value: value.to_string(), + from_type: "STRING".to_string(), + to_type: "TIMESTAMP".to_string(), + }) + } else { + Ok(None) + } +} + /// ANSI mode raises on an unparseable TIMESTAMP_NTZ value; the other modes return null. fn invalid_ntz_timestamp(value: &str, eval_mode: EvalMode) -> SparkResult> { if eval_mode == EvalMode::Ansi { diff --git a/spark/src/test/scala/org/apache/comet/CometNativeCastSuite.scala b/spark/src/test/scala/org/apache/comet/CometNativeCastSuite.scala index 607b9b39184..2ffea3a0f72 100644 --- a/spark/src/test/scala/org/apache/comet/CometNativeCastSuite.scala +++ b/spark/src/test/scala/org/apache/comet/CometNativeCastSuite.scala @@ -1967,6 +1967,7 @@ class CometNativeCastSuite "2020-06-15T12:30:00 UTC", "2020-06-15T12:30:00+08:00:30", "2020-06-15T12:30:00-01:30:15", + "2020-06-15T12:30:00+8:0:3", "2024-03-10 02:30:00", "2024-11-03 01:30:00", "not a timestamp", From c5563dda6e1ebab8905dd1fcac9783773f1b5a01 Mon Sep 17 00:00:00 2001 From: Erik Bogado Date: Sun, 15 Nov 2026 18:46:08 -0300 Subject: [PATCH 6/8] docs: correct second-precision timestamp offsets --- .../compatibility/expressions/_category_template/cast.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/source/user-guide/latest/compatibility/expressions/_category_template/cast.md b/docs/source/user-guide/latest/compatibility/expressions/_category_template/cast.md index 5cc435c6b09..0acfc522641 100644 --- a/docs/source/user-guide/latest/compatibility/expressions/_category_template/cast.md +++ b/docs/source/user-guide/latest/compatibility/expressions/_category_template/cast.md @@ -132,7 +132,7 @@ does. The following forms are supported: - `Z`, and `UTC`, `GMT` or `UT` on their own or followed by an offset (e.g. `UTC`, `GMT-01:00`, `UTC+8`). - Offsets in the forms `+H`, `+HH`, `+HHMM`, `+HHMMSS`, `+H:M`, `+HH:MM` and `+H:MM:SS` - (e.g. `+07:30`, `-0800`, `+080000`, `+08:00:00`). + (e.g. `+07:30`, `-0800`, `+080000`, `+08:00:00`, `+08:00:30`, `+080030`). - The Java `ZoneId.SHORT_IDS` aliases `ACT`, `AET`, `AGT`, `ART`, `AST`, `BET`, `BST`, `CAT`, `CNT`, `CST`, `CTT`, `EAT`, `ECT`, `IET`, `IST`, `JST`, `MIT`, `NET`, `NST`, `PLT`, `PNT`, `PRT`, `PST`, `SST` and `VST`, which map to a region and follow its daylight saving time, and @@ -140,9 +140,7 @@ does. The following forms are supported: - Time zone database region ids, with or without a `/` and with or without a space before them (e.g. `Europe/Moscow`, `America/Los_Angeles`, `CET`, `Zulu`, `Etc/GMT+8`). -Zone ids are case sensitive, as in Spark. Offsets with a non-zero seconds part (e.g. `+08:00:30`) -are not supported: Comet returns `NULL`, or raises `CAST_INVALID_INPUT` in ANSI mode, where Spark -returns a value. See [#7224](https://github.com/apache/datafusion-comet/issues/7224). +Zone ids are case sensitive, as in Spark. ## String to TimestampNTZ From abc6b5b57daeb4a21b43f0d6980cbde614ad7f08 Mon Sep 17 00:00:00 2001 From: Erik Bogado Date: Mon, 16 Nov 2026 14:45:44 -0300 Subject: [PATCH 7/8] ci: rerun current timestamp cast changes From 2c802ad59ed3be2a5968a8c4683536995e3c4592 Mon Sep 17 00:00:00 2001 From: Erik Bogado Date: Mon, 16 Nov 2026 14:47:50 -0300 Subject: [PATCH 8/8] ci: request fork cast validation The previous push produced no Actions run. Retry with the authenticated GitHub CLI identity.