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

TJ Banghart commented on CALCITE-5346:
--------------------------------------

I was looking at this again and it seems that user-defined types can be used to 
achieve generic type aliases. The issue is that they are locked to specific 
schemas and must be scoped within expressions:

{{SELECT CAST(foo as <schema>.myType) FROM <schema>.<table>;}}

It would be great to be able to define types for all schema that one could 
declare at root:
{
  version: '1.0',
  defaultSchema: 'mongo',
  schemas: [ Schema... ],
  *types: [Types... ]*
}

Schema specific types would take precedent but then we could check global 
custom types and default to the standard. Does this seem like a feasible 
option? I think we wouldn't have to touch the parser much if at all.

> 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