Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] UnsignedLong类型的支持 #2958

Closed
Taogang00 opened this issue Sep 14, 2024 · 1 comment
Closed

[BUG] UnsignedLong类型的支持 #2958

Taogang00 opened this issue Sep 14, 2024 · 1 comment
Assignees
Labels
bug Something isn't working fixed
Milestone

Comments

@Taogang00
Copy link

Taogang00 commented Sep 14, 2024

问题描述

使用clickhouse-java 的jdbc驱动,对select count(1) 查询的结果序列化返回数据时,不支持UnsignedLong等UnsignedXxx 类型,目前看其他json 框架均支持

环境信息

  • OS信息: Win10
  • JDK信息: 17
  • 版本信息:当前最新

重现步骤

如何操作可以重现该问题:

  1. run main
  2. 代码
        <dependency>
            <groupId>com.clickhouse</groupId>
            <artifactId>clickhouse-jdbc</artifactId>
            <version>0.6.5</version>
            <classifier>http</classifier>
        </dependency>
    public static void main(String[] args) throws JsonProcessingException {
        UnsignedLong unsignedLong = UnsignedLong.valueOf(123456789L);

        Map<String, Object> map = new HashMap<>();
        map.put("count", unsignedLong);

        //fastjson2
        System.out.println("fastjson2:  " + JSONObject.toJSONString(map));

        //jackson
        ObjectMapper objectMapper = new ObjectMapper();
        System.out.println("jackson:  " + objectMapper.writeValueAsString(map));

        //hutool-json
        System.out.println("hutool-json:  " + JSONUtil.toJsonStr(map));

        //gson
        Gson gson = new GsonBuilder().create();
        System.out.println("gson:  " + gson.toJson(map));
    }

期待的正确结果

正常输出count

相关日志输出

fastjson2: {"count":{}}
jackson: {"count":123456789}
hutool-json: {"count":123456789}
gson: {"count":{"value":123456789}}

附加信息

image

@Taogang00 Taogang00 added the bug Something isn't working label Sep 14, 2024
@wenshao wenshao added this to the 2.0.53 milestone Sep 14, 2024
@wenshao wenshao added the fixed label Sep 15, 2024
@wenshao wenshao self-assigned this Sep 15, 2024
@wenshao
Copy link
Member

wenshao commented Sep 16, 2024

https://github.com/alibaba/fastjson2/releases/tag/2.0.53
问题已修复,请用新版本

@wenshao wenshao closed this as completed Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

2 participants