Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/19364 )
Change subject: IMPALA-11778: Printing maps may produce invalid json ...................................................................... IMPALA-11778: Printing maps may produce invalid json Impala allows non-string types, for example numbers, to be keys in maps. We print maps as json objects, but json objects only allow string keys. If the Impala map has for example an INT key, the printed json is invalid. For example, in Impala the following two maps are not the same: {1: "a", 2: "b"} {"1": "a", "2": "b"} The first map has INT keys, the second has STRING keys. Only the second one is valid json. Hive has the same behaviour as Impala, i.e. it produces invalid json if the map keys have a non-string type. This change introduces the STRINGIFY_MAP_KEYS query option that, when set to true, converts non-string keys to strings. The default value of the new query option is false because - conversion to string causes loss of information and - setting it to true would be a breaking change. Testing: - Added tests in nested-map-in-select-list.test and map_null_keys.test that check the behaviour when STRINGIFY_MAP_KEYS is set to true. Change-Id: I1820036a1c614c34ae5d70ac4fe79a992c9bce3a Reviewed-on: http://gerrit.cloudera.org:8080/19364 Reviewed-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> --- M be/src/runtime/complex-value-writer.h M be/src/runtime/complex-value-writer.inline.h M be/src/service/hs2-util.cc M be/src/service/hs2-util.h M be/src/service/impala-beeswax-server.cc M be/src/service/impala-hs2-server.cc M be/src/service/query-options.cc M be/src/service/query-options.h M be/src/service/query-result-set.cc M be/src/service/query-result-set.h M common/thrift/ImpalaService.thrift M common/thrift/Query.thrift M testdata/workloads/functional-query/queries/QueryTest/map_null_keys.test M testdata/workloads/functional-query/queries/QueryTest/nested-map-in-select-list.test 14 files changed, 209 insertions(+), 98 deletions(-) Approvals: Impala Public Jenkins: Looks good to me, approved; Verified -- To view, visit http://gerrit.cloudera.org:8080/19364 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I1820036a1c614c34ae5d70ac4fe79a992c9bce3a Gerrit-Change-Number: 19364 Gerrit-PatchSet: 5 Gerrit-Owner: Daniel Becker <daniel.bec...@cloudera.com> Gerrit-Reviewer: Csaba Ringhofer <csringho...@cloudera.com> Gerrit-Reviewer: Daniel Becker <daniel.bec...@cloudera.com> Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Gerrit-Reviewer: Peter Rozsa <pro...@cloudera.com>