Quanlong Huang has posted comments on this change. ( http://gerrit.cloudera.org:8080/10950 )
Change subject: IMPALA-376: add built-in functions for parsing JSON ...................................................................... Patch Set 12: (12 comments) Refactor based on comments and add tests on the error messages. Please have a look when you got a chance. http://gerrit.cloudera.org:8080/#/c/10950/11/be/src/exprs/expr-test.cc File be/src/exprs/expr-test.cc: http://gerrit.cloudera.org:8080/#/c/10950/11/be/src/exprs/expr-test.cc@8804 PS11, Line 8804: "get_json_object('{\"a\":-1, \"b\":-2, \"c\":-3}', '$.b')", "-2"); > Hive's output is different here, but I think this behavior is more reasonab Nice find! http://gerrit.cloudera.org:8080/#/c/10950/11/be/src/exprs/expr-test.cc@8816 PS11, Line 8816: "get_json_object('[{\"key\": \"v1\"}, {\"key\": \"v2\"}]', '$[*].key')", : "[\"v1\",\"v2\"]"); : TestStringValue( : "get_json_object('[{\"key\": [1,2,3]}, {\"key\": [4,5]}]', '$[*].key')", : "[[1,2,3],[4,5]]"); : TestStringValue( : "get_json_object('[{\"key\": [1,2,3]}, {\"key\": [4,5]}]', '$[*].key[*]')", : "[1,2,3,4,5]"); : TestStringValue("get_json_object('[[0,1,2], [3,4, > Just a note here: Sure. I think we should align with MySQL in corner cases, since Hive's implementation seems not be strictly reviewed. http://gerrit.cloudera.org:8080/#/c/10950/11/be/src/exprs/string-functions.cc File be/src/exprs/string-functions.cc: http://gerrit.cloudera.org:8080/#/c/10950/11/be/src/exprs/string-functions.cc@49 PS11, Line 49: > We usually use DCHECK(false) for this in Impala. Done http://gerrit.cloudera.org:8080/#/c/10950/11/be/src/exprs/string-functions.cc@129 PS11, Line 129: > I don't think we need this, because hive also keeps the null values and I t Done. Nice find! http://gerrit.cloudera.org:8080/#/c/10950/11/be/src/exprs/string-functions.cc@176 PS11, Line 176: "Encounter '$1' in p > Please add test case for wildcard + spaces. Done http://gerrit.cloudera.org:8080/#/c/10950/11/be/src/exprs/string-functions.cc@177 PS11, Line 177: d > nit: add a space after the colon Done http://gerrit.cloudera.org:8080/#/c/10950/11/be/src/exprs/string-functions.cc@179 PS11, Line 179: > Please use static_cast<char>() to print it as a character instead of a numb Nice find. I should test the error messages too. Refined the tests in expr-test.cc http://gerrit.cloudera.org:8080/#/c/10950/11/be/src/exprs/string-functions.cc@254 PS11, Line 254: or > nit: might be better to use a named constant here, like INITIAL_QUEUE_CAPAC Done http://gerrit.cloudera.org:8080/#/c/10950/11/be/src/exprs/string-functions.cc@266 PS11, Line 266: nt i = 1; i < path_str.len; ) { > if it means an invalid selector then we should set an error. Done http://gerrit.cloudera.org:8080/#/c/10950/11/be/src/exprs/string-functions.cc@273 PS11, Line 273: > should be 'path_str' Oops! Done http://gerrit.cloudera.org:8080/#/c/10950/11/be/src/exprs/string-functions.cc@303 PS11, Line 303: it yet > should be 'path_str' Done. http://gerrit.cloudera.org:8080/#/c/10950/10/common/function-registry/impala_functions.py File common/function-registry/impala_functions.py: http://gerrit.cloudera.org:8080/#/c/10950/10/common/function-registry/impala_functions.py@514 PS10, Line 514: > flake8: E501 line too long (98 > 90 characters) Done -- To view, visit http://gerrit.cloudera.org:8080/10950 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I6a9d3598cb3beca0865a7edb094f3a5b602dbd2f Gerrit-Change-Number: 10950 Gerrit-PatchSet: 12 Gerrit-Owner: Quanlong Huang <huangquanl...@gmail.com> Gerrit-Reviewer: Attila Jeges <atti...@cloudera.com> Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Gerrit-Reviewer: Quanlong Huang <huangquanl...@gmail.com> Gerrit-Reviewer: Tim Armstrong <tarmstr...@cloudera.com> Gerrit-Reviewer: Todd Lipcon <t...@apache.org> Gerrit-Reviewer: Zoltan Borok-Nagy <borokna...@cloudera.com> Gerrit-Comment-Date: Sat, 25 Aug 2018 09:04:16 +0000 Gerrit-HasComments: Yes