Stamatis Zampetakis created CALCITE-6954:
--------------------------------------------

             Summary: SqlTypeFactoryImpl#leastRestrictive returns non-canonical 
collection types
                 Key: CALCITE-6954
                 URL: https://issues.apache.org/jira/browse/CALCITE-6954
             Project: Calcite
          Issue Type: Improvement
    Affects Versions: 1.39.0
            Reporter: Stamatis Zampetakis
            Assignee: Stamatis Zampetakis


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)

Reply via email to