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

org.msgpack.core.MessageTypeCastException for DECIMAL type #25

Open
weasellin opened this issue May 23, 2020 · 1 comment
Open

org.msgpack.core.MessageTypeCastException for DECIMAL type #25

weasellin opened this issue May 23, 2020 · 1 comment

Comments

@weasellin
Copy link

The org.msgpack.core.MessageTypeCastException would be thrown when the results of the td query contains DECIMAL type.

This exception cause by the following reason.

Since the DECIMAL type "columns" are interpreted as embulks DOUBLE type,
https://github.com/treasure-data/embulk-input-td/blob/v0.2.3/src/main/java/org/embulk/input/td/TdInputPlugin.java#L233

however the DECIMAL type "data fields" are packed and unpacked as MessagePack's String type.

ex.
This query

SELECT * FROM ( VALUES DECIMAL '0.0' ) AS t (dec)

would yeid the msgpack serialized bytes sequence 0x91 0xA3 0x30 0x2E 0x30,
and deserialized as fixstr type (first byte 0xa0 - 0xbf)

And for the ImmutableStringValue, it doesn't support asFloatValue() and will end up with throwing the MessageTypeCastException.

The following is the testing environment I used to reproduce the issue.

  • Embulk v0.9.22
  • plugin embulk-input-td (0.2.3)
  • td-client version: 0.9.0
  • config.yml
in:
  type: td
  apikey: [MY_API_KEY]
  database: [MY_DB]
  query: |
    SELECT * FROM ( VALUES DECIMAL '0.0' ) AS t (dec)

out:
  type: stdout
  • run embulk preview config.yml
@gccj
Copy link

gccj commented Aug 12, 2020

I had the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants