googleapis / java-bigquerystorage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JsonStreamWriter simple types to string conversion

anthavio opened this issue · comments

We are trying to migrate from legacy streaming API but we encountered following difference when using storage api with default stream.
Using storage writer, integer value in data is NOT automatically converted to string for fields with string type in schema. Oddly enough other way around, string in data but integer in schema, automatic conversion happens when string in data value actually is number string, for example "1"

Looking into JsonToProtoMessage code, lots of conversion is performed in different cases therefore I believe simple conversion like this should be done too.
If it is unacceptable for some reason, we can add boolean field (allowToStringConversions) to JsonStreamWriter Builder as feature flag to enable these conversions on request rather then by default.

Here is PR with suggested changes - #2437