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

Julian Hyde commented on CALCITE-7549:
--------------------------------------

Smells funny to me.

First, there's a lifetime mismatch. I think of a programs as long-lived (often 
constant) whereas listeners usually live within a session (and have state that 
builds up, such as a PrintWriter).

Second, the code of that program is very particular. I am skeptical that anyone 
besides you will need exactly that code. Can you find a way to do this that is 
more reusable?

> Add Programs.of overload that accepts RelOptListener
> ----------------------------------------------------
>
>                 Key: CALCITE-7549
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7549
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Shikha
>            Assignee: Shikha
>            Priority: Minor
>              Labels: pull-request-available
>
> Programs.of(HepProgram, boolean, RelMetadataProvider) constructs a HepPlanner 
> internally with no way to attach a RelOptListener before findBestExp(). This 
> makes it impossible to observe rule firings when composing phases via 
> Programs.sequence.                                                          
> Proposal: Add an overload Programs.of(HepProgram, boolean, 
> RelMetadataProvider, RelOptListener) that attaches the listener to the 
> internally-constructed HepPlanner before calling setRoot/findBestExp. When 
> listener is null, behavior is identical to the existing method.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to