Paul Rogers has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11974 )

Change subject: IMPALA-5973: Provide query plan in JSON format
......................................................................


Patch Set 3:

Thanks much for the contribution.

The implementation here is helpful, and is a JSON representation of the explain 
string, which is a bit different than a JSON representation of the plan itself. 
The representation here would still require a tool to parse the strings, though 
now the strings are a bit easier to find.

Since we'd need a parser anyway, we could just parse the original string form. 
(I wrote such a parser, tedious, but not difficult.)

What we'd like is something that stores each interesting value as a separate 
JSON key/value pair. Just making something up:

node: {
  type: "HDFS-SCAN",
  id: "5",
  table: "functional.alltypes",
  cardinality: 1234,
  ...
}

To get such a format, we'd have to create a new method on each plan object; we 
would not want to just overload the existing describe method with additional 
functionality. This would be quite a bit of work, and we'd have to decide on 
exactly what we want in the JSON output.

FWIW, if we want the entire plan, in all its gory detail, we can use Thrift:

    ...
    TExecRequest execRequest = frontend_.createExecRequest(queryCtx, 
explainBuilder);
    TSerializer serializer = new TSerializer(new TSimpleJSONProtocol.Factory());
    String json = serializer.toString(execRequest);

See: 
https://stackoverflow.com/questions/21597271/convert-an-object-to-a-json-string-with-thrift-json-serialization

The resulting JSON includes all the details of the plan: it is very large. Run 
it through here to turn it into a nicely formatted tree: 
https://jsonformatter.curiousconcept.com

Even if we offer a simplified JSON plan, seems we should also offer the full 
plan in JSON as the most detailed option.

Or, perhaps we can use the Thrift tree as the basis, with some simplifications 
to make the JSON more compact.


--
To view, visit http://gerrit.cloudera.org:8080/11974
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0f07e2223be58b7323e1ea2fa44b62626cdf4944
Gerrit-Change-Number: 11974
Gerrit-PatchSet: 3
Gerrit-Owner: Pranay Singh (320)
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Paul Rogers <[email protected]>
Gerrit-Reviewer: Philip Zeyliger <[email protected]>
Gerrit-Comment-Date: Sat, 01 Dec 2018 01:08:31 +0000
Gerrit-HasComments: No

Reply via email to