[ 
https://issues.apache.org/jira/browse/CALCITE-6775?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ruben Q L updated CALCITE-6775:
-------------------------------
    Description: 
ToChar and ToTimestamp PG implementors should use translator's root instead of 
creating a new root expression.

This issue can go easily under the radar because it seems it's only problematic 
on constant folding execution via RexExecutor (which in turn is executed within 
a try-catch, so no apparent problem would reach the surface).
These PG implementors create new expressions for the "root" DataContext, but 
they should take this expression from the translator itself. The problem is 
that, during RexToLinx translation, while generating the dynamic code, there 
are some optimizations to remove unused variables, and with the existing code 
the root expression can be incorrectly detected as unused and removed (because 
the optimization process uses identity equalities), leading to compilation 
errors on the dynamic code.











  was:
ToChar and ToTimestamp PG implementors should use translator's root instead of 
creating a new root expression.



> ToChar and ToTimestamp PG implementors should use translator's root instead 
> of creating a new root expression
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-6775
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6775
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.38.0
>            Reporter: Ruben Q L
>            Assignee: Ruben Q L
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.39.0
>
>
> ToChar and ToTimestamp PG implementors should use translator's root instead 
> of creating a new root expression.
> This issue can go easily under the radar because it seems it's only 
> problematic on constant folding execution via RexExecutor (which in turn is 
> executed within a try-catch, so no apparent problem would reach the surface).
> These PG implementors create new expressions for the "root" DataContext, but 
> they should take this expression from the translator itself. The problem is 
> that, during RexToLinx translation, while generating the dynamic code, there 
> are some optimizations to remove unused variables, and with the existing code 
> the root expression can be incorrectly detected as unused and removed 
> (because the optimization process uses identity equalities), leading to 
> compilation errors on the dynamic code.



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

Reply via email to