-
Notifications
You must be signed in to change notification settings - Fork 7
Description
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