You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/06/10 04:31:27 UTC

[GitHub] [pulsar] freeznet opened a new issue #10882: Gson convert int/long into float and breaks sink/source config

freeznet opened a new issue #10882:
URL: https://github.com/apache/pulsar/issues/10882


   **Describe the bug**
   pulsar-admin uses `gson` to parse Sink & Source config when user create connector with `--sink-config` or `--source-config`. When user pass int values as JSON, `gson` will convert the int/long value into float, then it will write as float string. With some of the connectors, this will breaks the serde of config.
   
   ```
   java.lang.IllegalArgumentException: Cannot deserialize value of type `long` from String "5000.0": not a valid `long` value
    at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: org.apache.pulsar.io.datagenerator.DataGeneratorSourceConfig["sleepBetweenMessages"])
   	at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:4314) ~[java-instance.jar:?]
   	at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:4245) ~[java-instance.jar:?]
   	at org.apache.pulsar.io.datagenerator.DataGeneratorSourceConfig.loadOrGetDefault(DataGeneratorSourceConfig.java:49) ~[?:?]
   	at org.apache.pulsar.io.datagenerator.DataGeneratorSource.open(DataGeneratorSource.java:36) ~[?:?]
   	at org.apache.pulsar.functions.instance.JavaInstanceRunnable.setupInput(JavaInstanceRunnable.java:734) ~[io.streamnative-pulsar-functions-instance-2.8.0-rc-202106091215.jar:?]
   	at org.apache.pulsar.functions.instance.JavaInstanceRunnable.setup(JavaInstanceRunnable.java:219) ~[io.streamnative-pulsar-functions-instance-2.8.0-rc-202106091215.jar:?]
   	at org.apache.pulsar.functions.instance.JavaInstanceRunnable.run(JavaInstanceRunnable.java:243) [io.streamnative-pulsar-functions-instance-2.8.0-rc-202106091215.jar:?]
   	at java.lang.Thread.run(Unknown Source) [?:?]
   Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `long` from String "5000.0": not a valid `long` value
   ```
   
   **Screenshots**
   ![image](https://user-images.githubusercontent.com/1381618/121465087-bc607b00-c9e7-11eb-94ee-e66f530cdeed.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] sijie closed issue #10882: Gson convert int/long into float and breaks sink/source config

Posted by GitBox <gi...@apache.org>.
sijie closed issue #10882:
URL: https://github.com/apache/pulsar/issues/10882


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org