You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2016/12/29 21:54:58 UTC

[jira] [Comment Edited] (DRILL-5116) Enable generated code debugging in each Drill operator

    [ https://issues.apache.org/jira/browse/DRILL-5116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15786211#comment-15786211 ] 

Paul Rogers edited comment on DRILL-5116 at 12/29/16 9:54 PM:
--------------------------------------------------------------

The fix for this will be to add three lines to each {{CodeGenerator}} use:

{code}
    cg.plainOldJavaCapable(true);
    // Uncomment out this line to debug the generated code.
 //   cg.preferPlainOldJava(true);
{code}

The first line marks the generated code as compatible with "plain-old Java" compilation with no byte-code fix-ups.

As it turns out, many such code generators produce code with errors, often related to exception handling. It seems that the current method is ignorant of conflicts between exceptions declared in implemented methods and those declared in the template.  For example:

Template:

{code}
{code}

Generated code:

{code}
{code}

Also, in one or two cases, the interface that the template implements declares methods which are never implemented: in neither the template nor the generated code.

The {{plainOldJavaCapable(true)}} is added once the above errors are fixed.

Then, the second line, {{cg.preferPlainOldJava(true)}} is optional, it tells Drill to actually go ahead and generate the code as plain-old Java. If you also tell Drill to save the generated code, using the {{drill.exec.compile.save_source}} option, you can step into the generated code.

Note that both lines are temporary. Once all operators have been upgraded, the first line can be removed. Also, this checkin provides an option to globally select plain-old Java, eliminating the need for the second line on a case-by-case basis.

A later pull request will remove these lines once everything has been converted and tested.


was (Author: paul-rogers):
The fix for this will be to add three lines to each {{CodeGenerator}} use:

{code}
    cg.plainOldJavaCapable(true);
    // Uncomment out this line to debug the generated code.
 //   cg.preferPlainOldJava(true);
{code}

The first line marks the generated code as compatible with "plain-old Java" compilation with no byte-code fix-ups.

As it turns out, many such code generators produce code with errors, often related to exception handling. It seems that the current method is ignorant of conflicts between exceptions declared in implemented methods and those declared in the template.  For example:

Template:

{code}
{code}

Generated code:

{code}
{code}

Also, in one or two cases, the interface that the template implements declares methods which are never implemented: in neither the template nor the generated code.

The {{plainOldJavaCapable(true)}} is added once the above errors are fixed.

Then, the second line, {{cg.preferPlainOldJava(true)}} is optional, it tells Drill to actually go ahead and generate the code as plain-old Java. If you also tell Drill to save the generated code, using the {{drill.exec.compile.save_source}} option, you can step into the generated code.

Note that both lines are temporary. Once all operators have been upgraded, the first line can be removed. Also, this checkin provides an option to globally select plain-old Java, eliminating the need for the second line on a case-by-case basis.

A later checkin will remove these lines once everything has been converted and tested.

> Enable generated code debugging in each Drill operator
> ------------------------------------------------------
>
>                 Key: DRILL-5116
>                 URL: https://issues.apache.org/jira/browse/DRILL-5116
>             Project: Apache Drill
>          Issue Type: Improvement
>    Affects Versions: 1.9.0
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>            Priority: Minor
>
> DRILL-5052 adds the ability to debug generated code. Some of the code generated by Drill's operators has minor problems when compiled directly using the new technique. These issues are ignore by the byte-code-merge technique uses in production. This ticket asks to try the DRILL-5052 feature in each operator, clean up any minor problems, and ensure each operator generates code suitable for debugging. Use the new {{CodeGenerator.plainOldJavaCapable()}} method to mark each generated class as ready for "plain-old Java" code gen.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)