slfan1989 commented on PR #7008:
URL: https://github.com/apache/iceberg/pull/7008#issuecomment-1463014914

   > in the past we haven't added these changes because it is unclear whether 
Iceberg should produce a resolved schema or an unresolved schema. Can you 
explain the purpose of both classes, what you plan to use in this PR, and why 
you've made that choice?
   
   Thank you very much for your question.
   
   We can refer to this document:
   
https://cwiki.apache.org/confluence/display/FLINK/FLIP-164%3A+Improve+Schema+Handling+in+Catalogs
   
   `FLIP-164` explains that `Schema` should distinguish between `unresolved` 
and `resolved` variant, while `TableSchema` is a hybrid between `resolved` and 
`unresolved` schema.
   
   `TableSchema` is split into 2 parts, `Schema` and `ResolvedSchema`.
   
   1. Schema
   ```
   Contains Unresolved fields, These fields may not be validated, for example, 
   there may be duplicate primary keys.
    Offers convenient methods to adopt columns etc. 
   
   Schema {
       static Schema.Builder newBuilder();
       List<UnresolvedColumn> getColumns();
       List<UnresolvedWatermarkSpec> getWatermarkSpecs();
       Optional<UnresolvedPrimaryKey> getPrimaryKey();
       ResolvedSchema resolve(SchemaResolver);
   }
   ```
   
   2. ResolvedSchema
   ```
   Class that is exposed by the framework at different locations for validated 
and complete schema.
   It replaces TableSchema
   
   ResolvedSchema {
       int getColumnCount();
       List<Column> getColumns();
       Optional<Column> getColumn(int);
       Optional<Column> getColumn(String);
       List<WatermarkSpec> getWatermarkSpecs();
       Optional<UniqueConstraint> getPrimaryKey();
       DataType toRowDataType();
       DataType toPhysicalRowDataType();
       DataType toPersistedRowDataType();
   .....
   }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to