You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Benchao Li <li...@apache.org> on 2023/01/26 07:25:38 UTC

Re: How to use IntelliJ debug code generated by janino?

Hi guangyuan, I've created a PR[1] for CALCITE-5442. You can try it now
with this patch.

[1] https://github.com/apache/calcite/pull/3045

Benchao Li <li...@apache.org> 于2022年12月19日周一 20:47写道:

> For the record, I've logged
> https://issues.apache.org/jira/browse/CALCITE-5442 for this issue.
> Contributions are welcome.
>
> Benchao Li <li...@apache.org> 于2022年12月16日周五 09:19写道:
>
>> Thanks Stamatis for mentioning of CALCITE-2196.
>>
>> +1 for doing it in other places, especially the EnumerableInterpretable.
>> It would be much easier for starters to learn how Calcite works.
>>
>> Stamatis Zampetakis <za...@gmail.com> 于2022年12月16日周五 01:21写道:
>>
>>> The changes in Janino were done explicitly to allow debugging [1]. If
>>> necessary we can do the same in other places as well.
>>>
>>> Best,
>>> Stamatis
>>>
>>> [1] https://issues.apache.org/jira/browse/CALCITE-2196
>>>
>>> On Thu, Dec 15, 2022 at 3:45 PM Benchao Li <li...@apache.org> wrote:
>>>
>>> > Hi guangyuan, have you done this successfully now?
>>> >
>>> > From my experience, this is not only a configuring problem. I'm not
>>> sure if
>>> > anyone who really has done this before in IDEA.
>>> >
>>> > There are several places in Calcite which uses Janino for codegen, such
>>> > as JaninoRelMetadataProvider[1] and EnumerableInterpretable[2].
>>> Actually
>>> > they are using Janino differently, JaninoRelMetadataProvider is
>>> compiling a
>>> > whole class string, while EnumerableInterpretable is compiling the
>>> class
>>> > body (without class declaration statement). I could debug the generated
>>> > code from JaninoRelMetadataProvider, but I could not do it for
>>> > EnumerableInterpretable. The reason is that Janino only put the class
>>> body
>>> > into the file, then IDEA could not find the real class cause it does
>>> not
>>> > exist actually.
>>> >
>>> > [1]
>>> >
>>> >
>>> https://github.com/apache/calcite/blob/de89d7a763d40846e68a9b62ed3294e595f82df7/core/src/main/java/org/apache/calcite/rel/metadata/JaninoRelMetadataProvider.java#L55
>>> > [2]
>>> >
>>> >
>>> https://github.com/apache/calcite/blob/de89d7a763d40846e68a9b62ed3294e595f82df7/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpretable.java#L72
>>> >
>>> > Alessandro Solimando <al...@gmail.com> 于2022年12月12日周一
>>> > 19:03写道:
>>> >
>>> > > Hi,
>>> > > apache ML strips attachments, so it's normal we can't see it, you can
>>> > > either use an external system and link to them, or better describe
>>> with
>>> > > plain text so it's also searchable.
>>> > >
>>> > > Best regards,
>>> > > Alessandro
>>> > >
>>> > > On Mon, 12 Dec 2022 at 09:33, Zou Dan <zo...@163.com> wrote:
>>> > >
>>> > > > Hi wangguangyuan
>>> > > > You could just right click the debug dir in IDEA and you could see
>>> the
>>> > > > option: “Mark Directory as" -> "Generated Source Root"
>>> > > >
>>> > > >
>>> > > > Best,
>>> > > > Dan Zou
>>> > > >
>>> > > > > 2022年12月12日 16:19,guangyuan wang <wa...@apache.org> 写道:
>>> > > > >
>>> > > > > Hello Dan
>>> > > > > Thank you very much.
>>> > > > > And I'd like to know how could I configure the debug dir as the
>>> > > > "Generated
>>> > > > > Source Root"?
>>> > > > > "2. Mark the debug dir you configured in step 1 as the "Generated
>>> > > Source
>>> > > > > Root".
>>> > > > >
>>> > > > > Zou Dan <zo...@163.com> 于2022年12月12日周一 15:33写道:
>>> > > > >
>>> > > > >> Hi wangguangyuan, the picture in your email are not displayed
>>> > > normally.
>>> > > > >> And I used to debug the generated code in IDEA follow the steps
>>> > below:
>>> > > > >> 1. Add two debug configurations:
>>> > > > >> "-Dorg.codehaus.janino.source_debugging.enable=true" and
>>> > > > >> "-Dorg.codehaus.janino.source_debugging.dir=/your_own_path"
>>> > > > >> 2. Mark the debug dir you configured in step1as the "Generated
>>> > Source
>>> > > > Root"
>>> > > > >> 3. Now, you are free to debug the generated code!
>>> > > > >>
>>> > > > >> Maybe you missed step2, hope it can help you.
>>> > > > >>
>>> > > > >>
>>> > > > >>> 2022年12月10日 20:28,guangyuan wang <wa...@apache.org>
>>> 写道:
>>> > > > >>>
>>> > > > >>> Dear all
>>> > > > >>>        I am trying to use IntelliJ debug code generated by
>>> janino,
>>> > > > >> according to the link:
>>> > > > >>
>>> > > >
>>> > >
>>> >
>>> https://calcite.apache.org/docs/howto.html#debugging-generated-classes-in-intellij
>>> > > > >> .
>>> > > > >>>        But I can not step into the generated source code, just
>>> like
>>> > > > >> this below.
>>> > > > >>>        Only could see the limited information of Baz. But can
>>> not
>>> > > open
>>> > > > >> the source code of Baz, and can not add breakpoint on the line
>>> of
>>> > the
>>> > > > Baz
>>> > > > >> source code.
>>> > > > >>>       I have also read the link:
>>> > > > >> https://janino-compiler.github.io/janino/#debugging
>>> > > > >>>       But I just can not step right into the generated code.
>>> > > > >>>       Below is my configuration:
>>> > > > >>>
>>> > > > >>
>>> > > > >>
>>> > > > >>
>>> > > > >> Best,
>>> > > > >> Dan Zou
>>> > > > >>
>>> > > > >>
>>> > > >
>>> > > >
>>> > >
>>> >
>>> >
>>> > --
>>> >
>>> > Best,
>>> > Benchao Li
>>> >
>>>
>>
>>
>> --
>>
>> Best,
>> Benchao Li
>>
>
>
> --
>
> Best,
> Benchao Li
>


-- 

Best,
Benchao Li