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

Tanner Clary updated CALCITE-5869:
----------------------------------
    Description: 
If you have a function with return type {{LEAST_RESTRICTIVE}}, that takes two 
arguments, and one of these arguments is an {{INTEGER}} and the other is a 
{{MEASURE<DOUBLE>}} you should expect that the latter is less restrictive. 
However, the logic in {{SqlTypeUtil#canCastFrom}} does not consider the case of 
measures where the type that should be used for comparisons is nested within. 
Because the {{SqlTypeFamily}} of a measure is {{ANY}}, that method will always 
return {{TRUE}}.

I have a small fix I will open a PR for, any comments would be appreciated.

  was:
If you have a function with return type {{LEAST_RESTRICTIVE}}, that takes two 
arguments, and one of these arguments is an {{INTEGER}} and the other is a 
{{MEASURE<DOUBLE>}} you should expect that the latter is less restrictive. 
However, the logic in {{SqlTypeUtil#canCastFrom}} does not consider the case of 
measures where the type that should be used for comparisons is nested within. 
Because the {{SqlTypeFamily}} of a measure is {{ANY}}, that method will always 
return {{TRUE}}.

I have a small fix I will open a PR for, but I am not certain it fully 
addresses the problem so any comments would be appreciated.


> LEAST_RESTRICTIVE does not use inner type of MEASURE for comparisons
> --------------------------------------------------------------------
>
>                 Key: CALCITE-5869
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5869
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Tanner Clary
>            Assignee: Tanner Clary
>            Priority: Major
>
> If you have a function with return type {{LEAST_RESTRICTIVE}}, that takes two 
> arguments, and one of these arguments is an {{INTEGER}} and the other is a 
> {{MEASURE<DOUBLE>}} you should expect that the latter is less restrictive. 
> However, the logic in {{SqlTypeUtil#canCastFrom}} does not consider the case 
> of measures where the type that should be used for comparisons is nested 
> within. Because the {{SqlTypeFamily}} of a measure is {{ANY}}, that method 
> will always return {{TRUE}}.
> I have a small fix I will open a PR for, any comments would be appreciated.



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

Reply via email to