childe / gohangout

使用 golang 模仿的 Logstash。用于消费 Kafka 数据,处理后写入 ES、Clickhouse 等。
MIT License
1.01k stars 234 forks source link

Solved ckoutput int type data output as 0 #199

Closed kingwide closed 1 year ago

kingwide commented 1 year ago

所有入库clickhouse的int类型数据均为0

childe commented 1 year ago

我是觉得使用 cast 库会更好,统一处理,代码清爽一些。

cast 1.5 已经解决了 json.Number 的问题,但是引入 了另外一个 Bug,所以我只能回退了 1.4.1 https://github.com/spf13/cast/issues/143

目前建议用户先 Convert 转成对应的类型再入库 Clickhouse 吧。

kingwide commented 1 year ago

感觉发布的版本应该至少是可用的, Convert 类型对于字段较多的表不太友好,且bug解决后还需要再修改配置文件

kingwide commented 1 year ago

能否考虑下使用临时版本暂时过渡下,这样用户不需要修改配置文件,等待cast的bug修复后再进行代码优化

childe commented 1 year ago

或者 PR 参考一下 convert 里面的代码,如果是 json.number 单独处理,剩下的使用 cast,也不用单独再加一个函数,就在 cast 前面加一个 if is json.number。 这样是不是简单可靠一些?毕竟 cast 考虑到的情况其实比较全。

childe commented 1 year ago

https://github.com/childe/gohangout/issues/201

我在这里处理掉了。 谢谢你的反馈和 PR,我就先关掉了。