@@ -4,16 +4,14 @@ use bytes::Bytes;
44use chrono:: { DateTime , TimeZone , Utc } ;
55use deltalake:: arrow:: array:: {
66 Array , ArrayRef , BinaryArray , BooleanArray , Date32Array , Date64Array , Float32Array ,
7- Float64Array , Int16Array , Int32Array , Int64Array , Int8Array , LargeBinaryArray ,
7+ Float64Array , Int8Array , Int16Array , Int32Array , Int64Array , LargeBinaryArray ,
88 LargeStringArray , StringArray , TimestampMicrosecondArray , TimestampMillisecondArray ,
9- TimestampNanosecondArray , TimestampSecondArray , UInt16Array , UInt32Array , UInt64Array ,
10- UInt8Array ,
9+ TimestampNanosecondArray , TimestampSecondArray , UInt8Array , UInt16Array , UInt32Array ,
10+ UInt64Array ,
1111} ;
1212use deltalake:: arrow:: datatypes:: DataType ;
1313use deltalake:: arrow:: record_batch:: RecordBatch ;
14- use deltalake:: delta_datafusion:: cdf:: {
15- CHANGE_TYPE_COL , COMMIT_TIMESTAMP_COL , COMMIT_VERSION_COL ,
16- } ;
14+ use deltalake:: delta_datafusion:: cdf:: { CHANGE_TYPE_COL , COMMIT_TIMESTAMP_COL , COMMIT_VERSION_COL } ;
1715use vector_lib:: config:: { LegacyKey , LogNamespace } ;
1816use vector_lib:: event:: { Event , LogEvent } ;
1917use vector_lib:: lookup:: path;
@@ -72,12 +70,11 @@ fn convert_batch_to_events(
7270 . ok_or_else ( || format ! ( "Null change_type at row {}" , row_idx) ) ?;
7371
7472 // Filter by change type if specified
75- if !config. change_types . is_empty ( ) {
76- if let Some ( ct) = ChangeType :: from_cdf_string ( & change_type_str) {
77- if !config. change_types . contains ( & ct) {
78- continue ;
79- }
80- }
73+ if !config. change_types . is_empty ( )
74+ && let Some ( ct) = ChangeType :: from_cdf_string ( & change_type_str)
75+ && !config. change_types . contains ( & ct)
76+ {
77+ continue ;
8178 }
8279
8380 let mut log = LogEvent :: default ( ) ;
@@ -306,7 +303,7 @@ fn arrow_value_to_vrl(
306303
307304 // Timestamps
308305 DataType :: Timestamp ( unit, _tz) => {
309- let ts = extract_timestamp_by_unit ( column, row_idx, unit)
306+ let ts = extract_timestamp_by_unit ( column, row_idx, * unit)
310307 . ok_or ( "Failed to extract timestamp" ) ?;
311308 Ok ( Value :: Timestamp ( ts) )
312309 }
@@ -399,7 +396,7 @@ fn extract_timestamp(column: &ArrayRef, row_idx: usize) -> Option<DateTime<Utc>>
399396 }
400397
401398 match column. data_type ( ) {
402- DataType :: Timestamp ( unit, _) => extract_timestamp_by_unit ( column, row_idx, unit) ,
399+ DataType :: Timestamp ( unit, _) => extract_timestamp_by_unit ( column, row_idx, * unit) ,
403400 DataType :: Int64 => {
404401 // Assume milliseconds if stored as plain Int64
405402 let arr = column. as_any ( ) . downcast_ref :: < Int64Array > ( ) ?;
@@ -413,7 +410,7 @@ fn extract_timestamp(column: &ArrayRef, row_idx: usize) -> Option<DateTime<Utc>>
413410fn extract_timestamp_by_unit (
414411 column : & ArrayRef ,
415412 row_idx : usize ,
416- unit : & deltalake:: arrow:: datatypes:: TimeUnit ,
413+ unit : deltalake:: arrow:: datatypes:: TimeUnit ,
417414) -> Option < DateTime < Utc > > {
418415 use deltalake:: arrow:: datatypes:: TimeUnit ;
419416
@@ -438,9 +435,7 @@ fn extract_timestamp_by_unit(
438435 Utc . timestamp_opt ( secs, nanos) . single ( )
439436 }
440437 TimeUnit :: Nanosecond => {
441- let arr = column
442- . as_any ( )
443- . downcast_ref :: < TimestampNanosecondArray > ( ) ?;
438+ let arr = column. as_any ( ) . downcast_ref :: < TimestampNanosecondArray > ( ) ?;
444439 let nanos = arr. value ( row_idx) ;
445440 let secs = nanos / 1_000_000_000 ;
446441 let subsec_nanos = ( nanos % 1_000_000_000 ) as u32 ;
0 commit comments