liamzwbao commented on code in PR #13072:
URL: https://github.com/apache/iceberg/pull/13072#discussion_r2105884381


##########
flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/FlinkSchemaUtil.java:
##########
@@ -192,7 +222,9 @@ public static Type convert(LogicalType flinkType) {
    *
    * @param rowType a RowType
    * @return Flink TableSchema
+   * @deprecated use {@link #toResolvedSchema(RowType)} instead
    */
+  @Deprecated
   public static TableSchema toSchema(RowType rowType) {

Review Comment:
   I just found an issue related to the migration just for this util.
   
   For the legacy `TableSchema.builder().build()`, it performs some validation 
in the [`build()` 
method](https://github.com/apache/flink/blob/cc11668578664dbd3627e37badc7f0cb9cdbcf4e/flink-table/flink-table-common/src/main/java/org/apache/flink/table/legacy/api/TableSchema.java#L816-L823).
 However, we lose those validations when using `ResolvedSchema.of()` directly 
as they are moved to 
[`SchemaResolver`](https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/DefaultSchemaResolver.java#L80-L92).
   
   So I think we have two options:
   1. Add the missing validation logic in this util function.
   2. Build a `Schema` first and then resolve it to `ResolvedSchema`, though 
this requires a `SchemaResolver`. That would mean changing the API, and I'm not 
sure how we can obtain a `SchemaResolver` in this context.
   
   BTW, I think that if this logic is only needed for tests, we could make it 
package-private.
   



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to