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 9:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/10950/9/be/src/exprs/string-functions.cc
File be/src/exprs/string-functions.cc:

http://gerrit.cloudera.org:8080/#/c/10950/9/be/src/exprs/string-functions.cc@51
PS9, Line 51:     return ctx_->Allocate(size);
> Cool! That's a better fit.
This refactor is simple but I hit a bug in rapidjson-0.11. In 
GenericDocument::ParseStream, the GenericReader does not use the allocator of 
GenericDocument, which means we lost the FunctionContext reference here. A null 
pointer error was thrown in GenericReader's code path.

        template <unsigned parseFlags, typename Stream>
        GenericDocument& ParseStream(Stream& stream) {
                ValueType::SetNull(); // Remove existing root if exist
                GenericReader<Encoding, Allocator> reader;    <-- here's the 
cause

One way to work around this is declaring the ctx_ variable in UdfJsonAllocator 
static and thread_local. We need thread_local again...

This rapidjson bug is fixed in 
https://github.com/Tencent/rapidjson/commit/87770399a18e190411170a4c23334fa81b5f7f34

I think the current implementation is acceptable until we upgrade the rapidjson 
version.



--
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: 9
Gerrit-Owner: Quanlong Huang <huangquanl...@gmail.com>
Gerrit-Reviewer: Attila Jeges <atti...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <huangquanl...@gmail.com>
Gerrit-Reviewer: Tim Armstrong <tarmstr...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <t...@apache.org>
Gerrit-Comment-Date: Tue, 31 Jul 2018 14:45:54 +0000
Gerrit-HasComments: Yes

Reply via email to