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

[jira] [Commented] (CALCITE-5621) Support UDT declarations from root of JSON schema model

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

TJ Banghart commented on CALCITE-5621:
--------------------------------------

Hey Julian, thanks for taking a look. Yes - the order of JSON elements should not matter. Since the "root" schema is globally accessible this should only allow for unscoped type references. If the same type name is used within a sub-schema then it will need to be scoped to that schema (eg. {{schema1.foo_type}}). 

I believe declaring "root" UDTs was already possible via DDL statements. This change simply surfaces that functionality to the JSON/YAML models.

> Support UDT declarations from root of JSON schema model
> -------------------------------------------------------
>
>                 Key: CALCITE-5621
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5621
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: TJ Banghart
>            Assignee: TJ Banghart
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Related to CALCITE-5346. 
> This change would allow for declaring user-defined types at the root of a schema model and allows for easy type alias mapping. 
> These data types are shared by all schema in the model so cast and DDL expressions do not need to scope data type references to a particular sub-schema. 
> For example: 
> {code}
> ...
>   "inline":{
>     "version":"1.0",
>     "types":[
>       {
>         "name":"BOOL",
>         "type":"BOOLEAN"
>       },
>       {
>         "name":"BYTES",
>         "type":"VARBINARY"
>       }
>     ]
> ...
> {code}
> Would allow for {{CAST("true" as BOOL)}}



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