You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2018/11/21 23:50:00 UTC

[jira] [Created] (IMPALA-7881) Visualize AST for easier debugging

Paul Rogers created IMPALA-7881:
-----------------------------------

             Summary: Visualize AST for easier debugging
                 Key: IMPALA-7881
                 URL: https://issues.apache.org/jira/browse/IMPALA-7881
             Project: IMPALA
          Issue Type: Improvement
          Components: Frontend
    Affects Versions: Impala 3.0
            Reporter: Paul Rogers
            Assignee: Paul Rogers


The parser creates a "raw" AST (abstract syntax tree), which is then "decorated" by the analyzer. Often, when debugging the analyzer, one wants to see the state of the tree. At present, doing so using an IDE's debugger is tedious as one has to slowly navigate within the tree.

 Provide a debug tool that visualizes the tree. For example:

{noformat}
<root> (SelectStmt): {
. isExplain: false
. analyzer: <Skip Analyzer>
. withClause: <null>
. orderByElements: [
. . 0 (OrderByElement): {
. . . expr (SlotRef): {
...
. selectList (SelectList): {
. . planHints: []
. . isDistinct: false
. . items: [
. . . 0 (SelectListItem): {
. . . . expr (SlotRef): {
...
. . . . . rawPath: [
. . . . . . 0: "id"
. . . . . ]
. . . . . label: "id"
{noformat}

Many improvements can be made. (Format as JSON, export to a nice JSON visualizer, etc.) The purpose here is to just get started.

To avoid the need to write code for every AST node class (of which there are many), use Java introspection to walk fields directly. The result may be overly verbose, but it is a quick way to get started.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)