[
https://issues.apache.org/jira/browse/CALCITE-6954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17945339#comment-17945339
]
Stamatis Zampetakis commented on CALCITE-6954:
----------------------------------------------
[~asolimando] The problem surfaced during the Calcite upgrade in Hive
(HIVE-27102). Some redundant CASTs appeared in the plans and due to some other
side effects the issue was causing wrong results for some queries.
> SqlTypeFactoryImpl#leastRestrictive returns non-canonical collection types
> --------------------------------------------------------------------------
>
> Key: CALCITE-6954
> URL: https://issues.apache.org/jira/browse/CALCITE-6954
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.39.0
> Reporter: Stamatis Zampetakis
> Assignee: Stamatis Zampetakis
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.40.0
>
>
> SqlTypeFactoryImpl#leastRestrictive method creates non-canonical types when
> it passes through:
> * leastRestrictiveArrayMultisetType
> * leastRestrictiveMapType
> The behavior violates the contract of the RelDataTypeFactory (see below) and
> creates problems since many places in the code compare RelDataType and rely
> on the object equality.
> The Javadoc of the RelDataTypeFactory states the following:
> {code:java}
> * Any implementation of <code>RelDataTypeFactory</code> must ensure that type
> * objects are canonical: two types are equal if and only if they are
> * represented by the same Java object. This reduces memory consumption and
> * comparison cost.
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)