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

Timo Walther commented on FLINK-17793:
--------------------------------------

Hi everyone,

I worked on a prototype for the new schema hierarchy in the last days. You can 
find the protoype here but it is in an early stage to figure out which parts we 
need to touch to make this work.

https://github.com/twalthr/flink/tree/FLINK-17793_2

Let me outline the rough design:

1) Reuse `table.api.TableColumn`, `table.api.WatermarkSpec`, 
`table.api.constraints.UniqueConstraint` but move them to `table.catalog`.

2) Introduce two Schema classes `table.api.Schema` for FLIP-129/FLIP-136 and 
`table.catalog.ResolvedSchema`.

3) Let `table.catalog.ResolvedSchema` implement most methods of `TableSchema` 
and resolve it with the help of a schema resolver.

4) Let `TableSchema` extend from `ResolvedSchema`.

5) Update API to properly split into `Schema` and `ResolvedSchema`. `Schema` 
will be returned by `CatalogBaseTable` such that expressions and data types can 
reference objects from other catalogs as well. `ResolvedSchema` will be 
returned by `QueryOperation`.

7) `TableColumn` and `WatermarkSpec` will be gradually reworked to remove the 
hybrid resolved/unresolved properties in members.

6) `DynamicTableFactory` will provide the resolved physical row data type and 
constraints as dedicated methods to avoid confusion which methods to call on 
`TableSchema.toRowDataType` or `TableSchema.toPhysicalRowDataType`.

We aim to let `table.api.TableSchema.Builder` untouched for backwards 
compatibility. However, implementations that use the rather new 
`add(TableColumn)` would need an update due to relocation and gradual 
refactorings.

> Replace TableSchema with dedicated CatalogSchema
> ------------------------------------------------
>
>                 Key: FLINK-17793
>                 URL: https://issues.apache.org/jira/browse/FLINK-17793
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / API
>            Reporter: Timo Walther
>            Assignee: Timo Walther
>            Priority: Major
>
> The {{TableSchema}} is used for representing the schema of catalog table and 
> the schema of a {{Table}} object and operation. We should split those 
> responsibilities both for a cleaner API and long-term separation of concerns. 
> Connectors should work on a CatalogSchema instead.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to