[ 
https://issues.apache.org/jira/browse/THRIFT-2210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15182243#comment-15182243
 ] 

Wenlong Dong commented on THRIFT-2210:
--------------------------------------

Unfortunately the change caused the Hive object not able to be serialized into 
JSON with TSimpleJSONProtocol:
https://github.com/apache/hive/blob/master/metastore/if/hive_metastore.thrift#L237
Here is the struct:
struct SkewedInfo {
  1: list<string> skewedColNames, // skewed column names
  2: list<list<string>> skewedColValues, //skewed values
  3: map<list<string>, string> skewedColValueLocationMaps, //skewed value to 
location mappings
}
The skewedColValueLocationMaps field is defined as a map with list as the key. 
The structure can be serialized and deserialized correctly with libthrift 
0.9.1. This change regressed the logic. People do use TSimpleJSONProtocol to 
serialize Hive objects for audit logs or such. This is a blocker for thrift 
upgrading. Could we remove the check for the case when the key is a 'list'? 
Thanks!

> lib/java TSimpleJSONProtocol can emit invalid JSON
> --------------------------------------------------
>
>                 Key: THRIFT-2210
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2210
>             Project: Thrift
>          Issue Type: Bug
>            Reporter: Alex Levenson
>            Assignee: Alex Levenson
>             Fix For: 0.9.2
>
>         Attachments: THRIFT-2210-v1.patch
>
>
> TSimpleJSONProtocol can emit JSON with maps whose keys are not string (which 
> is not allowed is the JSON spec).
> This happens if the key in a map is anything other than a String (int, enum, 
> etc)
> For example, it can emit JSON like this: 
> {noformat}
> {"myMap":{5:"myValue"}}
> {noformat}
> which should be:
> {noformat}
> {"myMap":{"5":"myValue"}}
> {noformat}
> I have a path that fixes this, I'll upload it shortly (still trying to get my 
> dev environment to run the tests).
> Also AFAICT there is no unit test for TSimpleJSONProtocol -- I'll try and add 
> one to the patch.
> Thanks!
> Alex



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to