ziyanTOP opened a new issue, #661:
URL: https://github.com/apache/doris-flink-connector/issues/661

   ## Bug Report
   
   **Describe the bug**
   When using `mongodb-sync-database` with `--mongodb-conf 
date.timezone=Asia/Shanghai`, the datetime fields written to Doris are still in 
UTC timezone.
   
   **Root Causes**
   1. Debezium serializes BSON Date as ISO 8601 strings (e.g. 
`\"2024-06-04T08:03:37Z\"`) instead of `{\"$date\": ...}` objects. The original 
`formatSpecialFieldData()` only handled the object form, so all date strings 
bypassed timezone conversion.
   2. `MongoDateConverter.timeZone` is a static variable set only on the Flink 
client side. After the serializer is serialized to TaskManagers, the static 
variable resets to default `\"UTC\"`, so TaskManagers always use UTC regardless 
of the configured timezone.
   
   **To Reproduce**
   1. Create a MongoDB collection with BSON Date fields
   2. Run `mongodb-sync-database` with `--mongodb-conf 
date.timezone=America/Sao_Paulo`
   3. Check Doris table — datetime values are still in UTC
   
   **Expected behavior**
   Datetime fields should be converted to the configured timezone before 
writing to Doris.
   
   **Environment**
   - doris-flink-connector version: 26.0.0
   - MongoDB: replica set / sharded cluster
   
   **Additional context**
   The fix involves:
   - Adding ISO 8601 string parsing in `formatSpecialFieldData()`
   - Passing timezone through `JsonDebeziumChangeContext` (Serializable) to 
TaskManagers
   - Adding `convertTimestampToString(long, String)` overload to avoid static 
state


-- 
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