seatunnel
seatunnel copied to clipboard
[mongo-cdc] NumberInt type and double type can not cdc to sink
Search before asking
- [X] I had searched in the issues and found no similar issues.
What happened
as we all know ,mongo save "price": 5.0 as numberInt save 5.1 as double,
{
"_id": ObjectId("661ddc79a6204ee9464b0823"),
"referPrice": 393.1,
}
{
"_id": ObjectId("661dd54b8daea7f8a65baa1a"),
"referPrice": NumberInt("393"),
}
when mongo-cdc defined the type as doube ,when it meet numberint err happlen
for example,save "price" { "price":NumberInt("10")----> NumberInt type }
{ "price":10.1----> double type } when cdc,a type error happlen ,because we had to set a type in schema.fields,if we set double, when meet int data ,err happlen,when set int,double data error happlen
SeaTunnel Version
2.3.4
SeaTunnel Config
source {
MongoDB-CDC {
hosts = "mongo0:27017"
database = ["inventory"]
collection = ["inventory.products"]
username = stuser
password = stpw
schema = {
fields {
"_id" : string,
"name" : string,
"description" : string,
"price" : double, --------when meet numberInt ,err~~~
}
}
}
}
Running Command
docker
Error Exception
orders-streaming | 2024-04-18 03:06:08,828 ERROR [o.a.s.c.s.SeaTunnel ] [main] - Fatal Error,
orders-streaming |
orders-streaming | 2024-04-18 03:06:08,828 ERROR [o.a.s.c.s.SeaTunnel ] [main] - Please submit bug report in https://github.com/apache/seatunnel/issues
orders-streaming |
orders-streaming | 2024-04-18 03:06:08,828 ERROR [o.a.s.c.s.SeaTunnel ] [main] - Reason:SeaTunnel job executed failed
orders-streaming |
orders-streaming | 2024-04-18 03:06:08,830 ERROR [o.a.s.c.s.SeaTunnel ] [main] - Exception StackTrace:org.apache.seatunnel.core.starter.exception.CommandExecuteException: SeaTunnel job executed failed
orders-streaming | at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:199)
orders-streaming | at org.apache.seatunnel.core.starter.SeaTunnel.run(SeaTunnel.java:40)
orders-streaming | at org.apache.seatunnel.core.starter.seatunnel.SeaTunnelClient.main(SeaTunnelClient.java:34)
orders-streaming | Caused by: org.apache.seatunnel.engine.common.exception.SeaTunnelEngineException: org.apache.seatunnel.connectors.seatunnel.cdc.mongodb.exception.MongodbConnectorException: ErrorCode:[COMMON-07], ErrorDescription:[Unsupported data type] - Unable to convert to integer from unexpected value 'BsonDouble{value=259080.00000000003}' of type DOUBLE
Zeta or Flink or Spark Version
No response
Java or Scala Version
No response
Screenshots
No response
Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Because Seatunnel constructs deserializer based on the schema of the collection, records that do not conform to the schema cannot be parsed naturally.
Because Seatunnel constructs deserializer based on the schema of the collection, records that do not conform to the schema cannot be parsed naturally.
so how to define both double and int
Or how to solve this problem