risingwave icon indicating copy to clipboard operation
risingwave copied to clipboard

bug(cdc): wrong output when mapping pg-numeric to varchar in postgres-cdc

Open KeXiangWang opened this issue 1 year ago • 2 comments

Describe the bug

In https://github.com/risingwavelabs/risingwave/pull/16346, we allow mapping numeric to varchar in postgres-cdc to avoid the precision loss of pg-numeric to rw-numeric in some scenarios. However the spacial value are converted to wrong string. To be specific:

value current output string expected output string
nan NAN NaN
inf POSITIVE_INFINITIY Infinity
-inf NEGATIVE_INFINITIY -Infinity

See more discussion here.

Error message/log

No response

To Reproduce

No response

Expected behavior

No response

How did you deploy RisingWave?

No response

The version of RisingWave

No response

Additional context

No response

KeXiangWang avatar Apr 19 '24 04:04 KeXiangWang

Caused by Debezium's PostgreSQL connector: https://gist.github.com/xiangjinwu/e879234981b65b08a074f27f6bab54ff?permalink_comment_id=5033378#gistcomment-5033378

xiangjinwu avatar Apr 23 '24 11:04 xiangjinwu

The default value of decimal.handling.mode is string in our config. https://github.com/risingwavelabs/risingwave/blob/201f90301041657d47a88ff3560febde16d4f123/java/connector-node/risingwave-connector-service/src/main/resources/debezium.properties#L10

Not sure whether our DebeziumJsonParser can handle the precise mode

precise represents values by using java.math.BigDecimal to represent values in binary form in change events.

StrikeW avatar Apr 30 '24 07:04 StrikeW

Now we use POSITIVE_INFINITIY, expected Infinity

fuyufjh avatar Jul 10 '24 09:07 fuyufjh