drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #660: Drill 5052: Option to debug generated Java code usi...
Date Sun, 20 Nov 2016 03:04:07 GMT
GitHub user paul-rogers opened a pull request:

    https://github.com/apache/drill/pull/660

    Drill 5052: Option to debug generated Java code using an IDE

    Drill makes extensive use of Java code generation to implement its operators. Drill uses
sophisticated techniques to blend generated code with pre-compiled template code. An unfortunate
side-effect of this behavior is that it is very difficult to visualize and debug the generated
code.
    
    As it turns out, Drill's code-merge facility is, in essence, a do-it-yourself version
of subclassing. The Drill "template" is the parent class, the generated code is the subclass.
But, rather than using plain-old subclassing, Drill combines the code from the two classes
into a single "artificial" packet of byte codes for which no source exists.
    
    This PR modifies the code generation path to optionally allow "plain-old Java" compilation:
the generated code becomes a subclass of the template. The generated code can then be compiled
as a plain-old Java class with no byte-code fix-up. A further option allows writing the code
to a known location that the IDE can search when looking for source files.
    
    With this change, developers can turn on the above feature, set a breakpoint in a template,
then step directly into the generated Java code called from the template.
    
    This provides an option to do the above, enabled by developers when needed. The existing
byte-code technique is used for production code generation.
    
    Included are a few examples from the External Sort Batch that shows the kinds of minor
fix-ups that might be needed for a template in order for the "plain-old Java" technique to
work.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/paul-rogers/drill DRILL-5052

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/drill/pull/660.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #660
    
----
commit 5af6bf038baea373fa2faeb0db3c5bac997bf3ec
Author: Paul Rogers <progers@maprtech.com>
Date:   2016-11-20T02:29:24Z

    DRILL-5052: Hygiene
    
    Fixes some broken toString( ) methods in code generation classes
    Fixes a variety of small compilation warnings
    Adds Java doc to a few classes

commit 39fdec1544e7356a936c36f06598217cfa43a1bc
Author: Paul Rogers <progers@maprtech.com>
Date:   2016-11-20T02:45:17Z

    DRILL-5052: Implementation
    
    Provides a second compilation path for generated code: “plan old Java”
    in which generated code inherit from their templates. Such code can be
    compiled directly, allowing easy debugging of generated code.

commit 6f2f4039c4b0ecbd722420cf25fc3a8b98d6106a
Author: Paul Rogers <progers@maprtech.com>
Date:   2016-11-20T02:54:04Z

    DRILL-5052: Examples
    
    Shows how to generate two classes in the External Sort Batch as “plain
    old Java” to enable IDE debugging of that generated code. Required
    minor clean-up of the templates.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message