You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Oliver Lee (Jira)" <ji...@apache.org> on 2023/02/16 19:55:00 UTC

[jira] [Updated] (CALCITE-5533) Unclear type name in FamilyOperandTypeChecker getAllowedSignature()

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

Oliver Lee updated CALCITE-5533:
--------------------------------
    Description: 
The error message from {{getAllowedSignature()}} for {{FamilyOperandTypeChecker}} [uses the SqlTypeFamily |https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/FamilyOperandTypeChecker.java#L190]instead of the actual type that is used/supplied.

 

For example this query using the Big Query dialect (BQ TIMESTAMP is Calcite's TIMESTAMP_WITH_LOCAL_TIME_ZONE)
{quote}SELECT TIMESTAMP_DIFF(1, TIMESTAMP "2008-12-25 15:30:00", HOUR)
{quote}
You would expect the error message in the current state to be produced using Calcite types:
{quote}Cannot apply 'TIMESTAMP_DIFF' to arguments of type 'TIMESTAMP_DIFF(<INTEGER>, <TIMESTAMP_WITH_LOCAL_TIME_ZONE(0)>, <INTERVAL HOUR>)'. Supported form(s): 'TIMESTAMP_DIFF(<TIMESTAMP_WITH_LOCAL_TIME_ZONE>, <TIMESTAMP_WITH_LOCAL_TIME_ZONE>, <ANY>)'
{quote}
However the error message is actually:

 
{quote}Cannot apply 'TIMESTAMP_DIFF' to arguments of type 'TIMESTAMP_DIFF(<INTEGER>, <TIMESTAMP_WITH_LOCAL_TIME_ZONE(0)>, <INTERVAL HOUR>)'. Supported form(s): 'TIMESTAMP_DIFF(<TIMESTAMP>, <TIMESTAMP>, <ANY>)'
{quote}
 

The [TIMESTAMP_DIFF|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java#L811] function checks that the operands are from the [SqlTypeFamily.TIMESTAMP|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java#L182] type family and the error message [uses the family name|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/FamilyOperandTypeChecker.java#L190] SqlTypeFamily.TIMESTAMP,  not the SqlTypeName  [SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java#L183].

 

 

  was:
The error message from in {{getAllowedSignature()}} for {{FamilyOperandTypeChecker}} [uses the SqlTypeFamily|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/FamilyOperandTypeChecker.java#L190]instead of the actual type that is used/supplied.

 

For example this query using the Big Query dialect (BQ TIMESTAMP is Calcite's TIMESTAMP_WITH_LOCAL_TIME_ZONE)
{quote}SELECT TIMESTAMP_DIFF(1, TIMESTAMP "2008-12-25 15:30:00", HOUR)
{quote}
You would expect the error message in the current state to be produced using Calcite types:
{quote}Cannot apply 'TIMESTAMP_DIFF' to arguments of type 'TIMESTAMP_DIFF(<INTEGER>, <TIMESTAMP_WITH_LOCAL_TIME_ZONE(0)>, <INTERVAL HOUR>)'. Supported form(s): 'TIMESTAMP_DIFF(<TIMESTAMP_WITH_LOCAL_TIME_ZONE>, <TIMESTAMP_WITH_LOCAL_TIME_ZONE>, <ANY>)'
{quote}
However the error message is actually:

 
{quote}Cannot apply 'TIMESTAMP_DIFF' to arguments of type 'TIMESTAMP_DIFF(<INTEGER>, <TIMESTAMP_WITH_LOCAL_TIME_ZONE(0)>, <INTERVAL HOUR>)'. Supported form(s): 'TIMESTAMP_DIFF(<TIMESTAMP>, <TIMESTAMP>, <ANY>)'
{quote}
 

The [TIMESTAMP_DIFF|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java#L811] function checks that the operands are from the [SqlTypeFamily.TIMESTAMP|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java#L182] type family and the error message [uses the family name|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/FamilyOperandTypeChecker.java#L190] SqlTypeFamily.TIMESTAMP,  not the SqlTypeName  [SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java#L183].

 

 


> Unclear type name in FamilyOperandTypeChecker getAllowedSignature()
> -------------------------------------------------------------------
>
>                 Key: CALCITE-5533
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5533
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Oliver Lee
>            Priority: Minor
>
> The error message from {{getAllowedSignature()}} for {{FamilyOperandTypeChecker}} [uses the SqlTypeFamily |https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/FamilyOperandTypeChecker.java#L190]instead of the actual type that is used/supplied.
>  
> For example this query using the Big Query dialect (BQ TIMESTAMP is Calcite's TIMESTAMP_WITH_LOCAL_TIME_ZONE)
> {quote}SELECT TIMESTAMP_DIFF(1, TIMESTAMP "2008-12-25 15:30:00", HOUR)
> {quote}
> You would expect the error message in the current state to be produced using Calcite types:
> {quote}Cannot apply 'TIMESTAMP_DIFF' to arguments of type 'TIMESTAMP_DIFF(<INTEGER>, <TIMESTAMP_WITH_LOCAL_TIME_ZONE(0)>, <INTERVAL HOUR>)'. Supported form(s): 'TIMESTAMP_DIFF(<TIMESTAMP_WITH_LOCAL_TIME_ZONE>, <TIMESTAMP_WITH_LOCAL_TIME_ZONE>, <ANY>)'
> {quote}
> However the error message is actually:
>  
> {quote}Cannot apply 'TIMESTAMP_DIFF' to arguments of type 'TIMESTAMP_DIFF(<INTEGER>, <TIMESTAMP_WITH_LOCAL_TIME_ZONE(0)>, <INTERVAL HOUR>)'. Supported form(s): 'TIMESTAMP_DIFF(<TIMESTAMP>, <TIMESTAMP>, <ANY>)'
> {quote}
>  
> The [TIMESTAMP_DIFF|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java#L811] function checks that the operands are from the [SqlTypeFamily.TIMESTAMP|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java#L182] type family and the error message [uses the family name|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/FamilyOperandTypeChecker.java#L190] SqlTypeFamily.TIMESTAMP,  not the SqlTypeName  [SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java#L183].
>  
>  



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