[
https://issues.apache.org/jira/browse/CALCITE-4834?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ruben Q L updated CALCITE-4834:
---
Description:
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, 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}
was:
This seems caused by CALCITE-4546.
{{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, 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}
> 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
> Fix For: 1.28.0
>
>
> 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, 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)