Daniel Becker has uploaded this change for review. ( 
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.

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
---
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(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/64/19364/2
--
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: newchange
Gerrit-Change-Id: I1820036a1c614c34ae5d70ac4fe79a992c9bce3a
Gerrit-Change-Number: 19364
Gerrit-PatchSet: 2
Gerrit-Owner: Daniel Becker <daniel.bec...@cloudera.com>

Reply via email to