@@ -72,6 +72,7 @@ pub trait EventFormat: Sized {
7272 schema_version,
7373 ) ?;
7474
75+ // DEFAULT_TAGS_KEY, DEFAULT_METADATA_KEY and DEFAULT_TIMESTAMP_KEY are reserved field names
7576 if get_field ( & schema, DEFAULT_TAGS_KEY ) . is_some ( ) {
7677 return Err ( anyhow ! ( "field {} is a reserved field" , DEFAULT_TAGS_KEY ) ) ;
7778 } ;
@@ -258,22 +259,23 @@ pub fn update_field_type_in_schema(
258259// From Schema v1 onwards, convert json fields with name containig "date"/"time" and having
259260// a string value parseable into timestamp as timestamp type and all numbers as float64.
260261pub fn override_data_type (
261- schema : Arc < Schema > ,
262+ inferred_schema : Arc < Schema > ,
262263 log_record : Value ,
263264 ignore_field_names : & HashSet < String > ,
264265 schema_version : SchemaVersion ,
265266) -> Arc < Schema > {
266267 let Value :: Object ( map) = log_record else {
267- return schema ;
268+ return inferred_schema ;
268269 } ;
269- let new_schema : Vec < Field > = schema
270+ let updated_schema : Vec < Field > = inferred_schema
270271 . fields ( )
271272 . iter ( )
272273 . map ( |field| {
273274 let field_name = field. name ( ) . as_str ( ) ;
274275 match ( schema_version, map. get ( field. name ( ) ) ) {
275276 // in V1 for new fields in json named "time"/"date" or such and having inferred
276277 // type string, that can be parsed as timestamp, use the timestamp type.
278+ // NOTE: support even more datetime string formats
277279 ( SchemaVersion :: V1 , Some ( Value :: String ( s) ) )
278280 if TIME_FIELD_NAME_PARTS
279281 . iter ( )
@@ -304,5 +306,5 @@ pub fn override_data_type(
304306 } )
305307 . collect ( ) ;
306308
307- Arc :: new ( Schema :: new ( new_schema ) )
309+ Arc :: new ( Schema :: new ( updated_schema ) )
308310}
0 commit comments