wombatu-kun opened a new pull request, #16604:
URL: https://github.com/apache/iceberg/pull/16604

   Closes #16603
   
   ### Problem
   
   `MongoDataConverter` (used by `MongoDebeziumTransform`) read BSON array 
elements with the wrong accessors when `array.encoding=array` (the default): 
`DATE_TIME` elements were read with `asInt64()` and `TIMESTAMP` elements with 
`asInt32()`. Because those elements are actually 
`BsonDateTime`/`BsonTimestamp`, `BsonValue` throws 
`BsonInvalidOperationException`, so any MongoDB document containing an array of 
timestamps or date-times failed to convert. The scalar (non-array) paths 
already use the correct accessors.
   
   ### Solution
   
   Read array `TIMESTAMP` and `DATE_TIME` elements with the same accessors as 
the scalar paths: `asTimestamp().getTime()` and `asDateTime().getValue()`.
   
   This file lives under `org.debezium.connector.mongodb.transforms` and was 
adapted from Debezium; the fix intentionally diverges from the (buggy) upstream 
snapshot.
   
   ### Tests
   
   Added `TestMongoArrayConverter.shouldConvertArrayOfTimestamps` and 
`shouldConvertArrayOfDateTimes`: they convert arrays of `BsonTimestamp` / 
`BsonDateTime` with `ArrayEncoding.ARRAY` and assert the resulting 
`java.util.Date` values. They fail before the change (with 
`BsonInvalidOperationException`) and pass after.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to