Ruben Q L created CALCITE-6495:
----------------------------------
Summary: Allow ProjectSetOpTransposeRule to work with any subclass
of Project
Key: CALCITE-6495
URL: https://issues.apache.org/jira/browse/CALCITE-6495
Project: Calcite
Issue Type: Improvement
Components: core
Affects Versions: 1.37.0
Reporter: Ruben Q L
Fix For: 1.38.0
Even if the default configuration of ProjectSetOpTransposeRule matches a
LogicalProject, theoretically any downstream project could adjust the rule
config to match a different subclass of Project, with the corresponding
RelBuilderFactory, to obtain the rule behavior customized for their needs.
However, at this point this cannot work because
ProjectSetOpTransposeRule#onMatch performs a
{code:java}
final LogicalProject origProject = call.rel(0);
{code}
which leads to a {{ClassCastException}} in this scenario.
Therefore, this line should be changed (and generalized) into
{code:java}
final Project origProject = call.rel(0);
{code}
(as it happens already in other rules, such as FilterSetOpTransposeRule or
ProjectFilterTransposeRule) to improve the rule's adaptability, without
impacting the rule's behavior.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)