Ivan Yaschishin created CALCITE-5335:
----------------------------------------

             Summary: SqlTypeUtil.keepSourceTypeAndTargetNullability does not 
respect recurrent RelDataTypes
                 Key: CALCITE-5335
                 URL: https://issues.apache.org/jira/browse/CALCITE-5335
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.31.0
            Reporter: Ivan Yaschishin
         Attachments: RecurrentRelDataTypeReproducer.java

This method is being used in default implementations of Sql2Rel converter, both 
during ROW expression conversion and sub-query conversions. A quick reproducer 
is attached below. 

The use case for recurrent RelDataTypes is having User Defined Types with 
support for Cyclic types e.g. type hierarchies defined as following:  

```sql

AType(id: BIGINT, bcol BType)

BType(id: BIGINT, acol AType)

```

Current implementation assumes that the input type hierarchy is non-cyclic and 
hits a StackOverflow. 

*Are Recurrent RelDataType instances generally supported by Calcite or is it 
expected that all RelDataType instances are acyclic?*



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to