[ 
https://issues.apache.org/jira/browse/CALCITE-4713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zuozhi Wang updated CALCITE-4713:
---------------------------------
    Description: 
When using JavaTypeFactoryImpl, calling `leastRestrictive` with two 
`JavaType(String)` types gives a wrong return type of `VARCHAR` (SqlType). The 
expected return type should still be `JavaType(String)` 

See the following test case:
{code:java}
  @Test void testLeastRestrictiveWithWithJavaString() {
    RelDataType javaStringType = TYPE_FACTORY.createJavaType(String.class);
    // leastRestrictive of two same JavaType(String) types
    RelDataType leastRestrictive = TYPE_FACTORY.leastRestrictive(
        Arrays.asList(javaStringType, javaStringType));
    // expect leastRestrictive to also be JavaType(String)
    // but actual value is VARCHAR (BasicSqlType)
    assertEquals(javaStringType, leastRestrictive);
  }
{code}



We are currently investigating a fix of this issue, possibly by adding some 
equality checks.


  was:
When using JavaTypeFactoryImpl, calling `leastRestrictive` with two 
`JavaType(String)` types gives a wrong return type of `VARCHAR` (SqlType). The 
expected return type should still be `JavaType(String)` 

See the following test case:
```
  @Test void testLeastRestrictiveWithWithJavaString() {
    RelDataType javaStringType = TYPE_FACTORY.createJavaType(String.class);
    // leastRestrictive of two same JavaType(String) types
    RelDataType leastRestrictive = TYPE_FACTORY.leastRestrictive(
        Arrays.asList(javaStringType, javaStringType));
    // expect leastRestrictive to also be JavaType(String)
    // but actual value is VARCHAR (BasicSqlType)
    assertEquals(javaStringType, leastRestrictive);
  }
```


We are currently investigating a fix of this issue, possibly by adding some 
equality checks.



> JavaTypeFactory#leastRestrictive returns wrong type for JavaType(String)
> ------------------------------------------------------------------------
>
>                 Key: CALCITE-4713
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4713
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.27.0
>            Reporter: Zuozhi Wang
>            Priority: Minor
>
> When using JavaTypeFactoryImpl, calling `leastRestrictive` with two 
> `JavaType(String)` types gives a wrong return type of `VARCHAR` (SqlType). 
> The expected return type should still be `JavaType(String)` 
> See the following test case:
> {code:java}
>   @Test void testLeastRestrictiveWithWithJavaString() {
>     RelDataType javaStringType = TYPE_FACTORY.createJavaType(String.class);
>     // leastRestrictive of two same JavaType(String) types
>     RelDataType leastRestrictive = TYPE_FACTORY.leastRestrictive(
>         Arrays.asList(javaStringType, javaStringType));
>     // expect leastRestrictive to also be JavaType(String)
>     // but actual value is VARCHAR (BasicSqlType)
>     assertEquals(javaStringType, leastRestrictive);
>   }
> {code}
> We are currently investigating a fix of this issue, possibly by adding some 
> equality checks.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to