FlinkCDC监控Oracle时json返回值异常(float,numeric)
`用flinkcdc 监控Oracle时如果Oracle字段类型是float,numeric,字段的值就显示异常,如下面所示Oracle数据如下图COLUMN2值为123,字段类型为floatflinkcdc返回的值为**“COLUMN2”:{“scale”:0,“value”:“ew==”}**斜体样式{“before”:{“NAME”:“1”,“AGE”:“12”,“CITY”:“ww”,“S
FlinkCDC监控Oracle时json返回值异常(float,numeric)
问题描述
`用flinkcdc 监控Oracle时如果Oracle字段类型是float,numeric,字段的值就显示异常,如下面所示
Oracle数据:COLUMN2值为123,字段类型为float
flinkcdc返回的值为"COLUMN2":{“scale”:0,“value”:“ew==”}
{“before”:{“NAME”:“1”,“AGE”:“12”,“CITY”:“ww”,“SEX”:“65”,“DCCDATE”:null,“COLUMN2”:{“scale”:0,“value”:“ew==”},“COLUMN3”:0.0,“COLUMN4”:0.0},“after”:{“NAME”:“1”,“AGE”:“12”,“CITY”:“ww”,“SEX”:“12”,“DCCDATE”:null,“COLUMN2”:{“scale”:0,“value”:“ew==”},“COLUMN3”:0.0,“COLUMN4”:0.0},“source”:{}}
我们希望返回的值为"COLUMN2":“123.0”
解决方案:
Properties properties = new Properties();
//加以下配置生效
properties.setProperty(“decimal.handling.mode”,“double”);
StreamExecutionEnvironment bsEnv = StreamExecutionEnvironment.getExecutionEnvironment();
bsEnv.setRuntimeMode(RuntimeExecutionMode.STREAMING);
Map<String, Object> customConverterConfigs = new HashMap<>();
customConverterConfigs.put(JsonConverterConfig.DECIMAL_FORMAT_CONFIG, "numeric");
SourceFunction<String> sourceFunction = OracleSource.<String>builder()
.hostname(host)
.port(1521)
.database(db)
.schemaList(schema)
.tableList(table)
.username(user)
.password(pw)
.startupOptions(StartupOptions.latest())
**.debeziumProperties(properties)**
.deserializer(new JsonDebeziumDeserializationSchema()
更多推荐
所有评论(0)