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

Ruben Q L resolved CALCITE-4834.
--------------------------------
    Resolution: Fixed

Fixed via 
https://github.com/apache/calcite/commit/50dbd12f14f330f57a321a2402a7dcb8124f5112

> JaninoRelMetadataProvider uses hardcoded class name
> ---------------------------------------------------
>
>                 Key: CALCITE-4834
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4834
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Ruben Q L
>            Assignee: Ruben Q L
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.28.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> This seems caused by CALCITE-4546 
> ([fbbdf46|https://github.com/apache/calcite/commit/fbbdf465df46b4e6f9863d7d1dfdcb19a43f2032])
> {{JaninoRelMetadataProvider}} lines 135 & 141 is using (for the generated 
> code) the hardcoded name of the class {{MetadataDef}}:
> {code}
> buff.append("  private final org.apache.calcite.rel.metadata.MetadataDef 
> def;\n");
> for (Map.Entry<MetadataHandler<?>, String> handlerAndName : 
> handlerToName.entrySet()) {
>   ...
>   .append("      org.apache.calcite.rel.metadata.MetadataDef def");
> {code}
> This can lead to issues (e.g. if a downstream project shades Calcite 
> library). The safer way to do this is using {{Class#getName}}, as it is 
> already done in the rest of the code, e.g. in 
> {{JaninoRelMetadataProvider:158}}:
> {code}
> .append(MetadataDef.class.getName())
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to