[ 
https://issues.apache.org/jira/browse/CALCITE-5346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17624079#comment-17624079
 ] 

Julian Hyde commented on CALCITE-5346:
--------------------------------------

Possibly this could be implemented with a new method in {{RelDataTypeSystem}} 
that has a method that returns a string-to-string map.

If you have created {{BOOL}} as an alias for {{{}BOOLEAN{}}}, and write 
{{SELECT foo(true)}} would the error message say "\{{Function not found: 
'FOO(<BOOL>)'}}" or "\{{Function not found: 'FOO(<BOOLEAN>)'}}". To achieve the 
former, the mapping to need to be bi-directional (i.e. a bijection).

If you have created {{BOOL}} as an alias for {{{}BOOLEAN{}}}, it will be valid 
to write {{{}SELECT CAST(1 AS BOOL){}}}, but should it be valid to write 
{{{}SELECT CAST(1 AS BOOLEAN){}}}?

Knowing a little of BigQuery's type system, I think it might be necessary to 
map {{TIMESTAMP}} to {{DATETIME}} and {{TIMESTAMP WITH LOCAL TIME ZONE}} to 
{{{}TIMESTAMP{}}}. That is, the mapping has an order to it, or in other words, 
behaves as a permutation.

Besides {{CAST}} and DDL (e.g. {{{}CREATE TABLE{}}}), where else are types used 
in Calcite?

Is {{STRING}} a direct substitution for {{{}VARCHAR{}}}?

Would the type alias scheme disallow certain types?

Can/should any parts of this be implemented using user-defined types? (See 
CALCITE-2045.)

> Support for type aliases
> ------------------------
>
>                 Key: CALCITE-5346
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5346
>             Project: Calcite
>          Issue Type: New Feature
>            Reporter: Will Noble
>            Assignee: Will Noble
>            Priority: Major
>
> We would like to support some sort of type alias functionality in order to 
> map certain [BigQuery 
> types|https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types]
>  to ISO types, e.g. {{STRING}} -> {{VARCHAR}}.



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

Reply via email to