@@ -103,12 +103,24 @@ static ERROR_PATTERNS: LazyLock<Vec<ErrorPattern>> = LazyLock::new(|| {
103103 query_sub: "to_date(" ,
104104 error_sub: "Casting from" ,
105105 } ,
106+ ErrorPattern :: QueryAndErrorContains {
107+ query_sub: "to_date(" ,
108+ error_sub: "Error parsing timestamp from" ,
109+ } ,
106110 ErrorPattern :: QueryAndErrorContains {
107111 query_sub: "to_char(" ,
108112 error_sub: "Cannot cast" ,
109113 } ,
110114 ErrorPattern :: Contains ( "Regular expression did not compile" ) ,
111115 ErrorPattern :: Contains ( "to_unixtime function unsupported data type" ) ,
116+ ErrorPattern :: QueryAndErrorContains {
117+ query_sub: "to_unixtime(" ,
118+ error_sub: "Error parsing timestamp from" ,
119+ } ,
120+ ErrorPattern :: QueryAndErrorContains {
121+ query_sub: "to_timestamp" ,
122+ error_sub: "Error parsing timestamp from" ,
123+ } ,
112124 // =========================
113125 // Known Issues
114126 // =========================
@@ -233,3 +245,32 @@ pub fn get_configured_patterns() -> Vec<String> {
233245 } )
234246 . collect ( )
235247}
248+
249+ #[ cfg( test) ]
250+ mod tests {
251+ use super :: is_error_whitelisted;
252+
253+ #[ test]
254+ fn whitelists_timestamp_parse_errors_for_to_timestamp_queries ( ) {
255+ let error = "Query execution failed: Execution error: Error parsing timestamp from 'abc' using format 'fmt': input contains invalid characters" ;
256+ let query = "SELECT to_timestamp_seconds(66, 'fmt')" ;
257+
258+ assert ! ( is_error_whitelisted( error, Some ( query) ) ) ;
259+ }
260+
261+ #[ test]
262+ fn does_not_whitelist_timestamp_parse_errors_without_to_timestamp_query ( ) {
263+ let error = "Query execution failed: Execution error: Error parsing timestamp from 'abc' using format 'fmt': input contains invalid characters" ;
264+ let query = "SELECT 1" ;
265+
266+ assert ! ( !is_error_whitelisted( error, Some ( query) ) ) ;
267+ }
268+
269+ #[ test]
270+ fn whitelists_timestamp_parse_errors_for_to_date_queries ( ) {
271+ let error = "Query execution failed: Execution error: Error parsing timestamp from 'abc' using format 'fmt': input contains invalid characters" ;
272+ let query = "SELECT to_date('abc', 'fmt')" ;
273+
274+ assert ! ( is_error_whitelisted( error, Some ( query) ) ) ;
275+ }
276+ }
0 commit comments